前几天我做了这些:写了一个DbServer类, 
IPHostEntry LocalHostEntry = Dns.GetHostByName(Dns.GetHostName());
string[] temp=LocalHostEntry.AddressList[0].ToString().Split('.');
//Change
port =(9000+Int32.Parse(temp[3])).ToString();  //port为端口,
///创建一个通道实例,该通道使用端口90后接本机ip最后一部分
/// MyChannel = new TcpChannel(Int32.Parse(port));
///注册通道 
///register the channel with the runtime
ChannelServices.RegisterChannel( MyChannel );
///register the remote type and pass in a uri identifying string
RemotingConfiguration.RegisterWellKnownServiceType( typeof( DbServer ), "wts", WellKnownObjectMode.Singleton);
如果用这种方法经常连接不了,求助另一方法?

解决方案 »

  1.   

    这个连接又是什么意思?是连接什么数据库?ascess也是这样连接吗?服务器还要分布什么端口之类吗?
    Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;
      

  2.   

    Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;
    和Provider=sqloledb;Data Source=190.190.200.100,1433;
    Initial Catalog=pubs;User ID=sa;Password=asdasd;
    可以看成是一样的。因为1433是SQL的默认端口;DBMSSOCN指的是,SQL SERVER 2000的默认SQL SERVER网络协议,即是tcp/ip,通过WAN连接到远程服务器时。,提供最好的连接速度,和最可靠的连接。
    Network Library:(网络库)将指定的用户用于与SQL SERVER 通信的协议。用户用于启动连接Network Library必须配置为SQL SERVER正在连接上的监听协议。ACCESS本质上是MSDE,即,SQL SERVER的缩小版。
      

  3.   

    public static string ConnString =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath+ @"\estate.mdb;Persist Security Info=False;Jet OLEDB:Database Password=abcd";
    Application.StartupPath可以该为:ip\c:\...\estate.mdb类似的相对路径。
      

  4.   

    一种用共享目录
    你可以使用http协议,通过XML在客户端和服务器端进行数据交换
    由于Dataset可以直接导出和导入xml文件,你可以以dataSet对象为媒介。当然这种结构比较复杂
      

  5.   

    试多次,这样是不行的。
    Application.StartupPath可以该为:ip\c:\...\estate.mdb类似的相对路径。
    除非把整成文件夹共享出来。还要设权限,才能写入,这样做,跟在一台机装一个程序.然后共享,在其他拉一个快捷方式出来有什么区别?
      

  6.   

    我提供两种方式:
    1、在Access的机器上装个Sql Server,通过Sql Server支持的Oledb来访问Access.
    2、利用Web Service技术(或者.Net Remoting)在装有Access的机器上提供Web Service服务然后远程访问Web Service服务就可以了~~~
      

  7.   

    alter procedure prGetInventotyProperties
    --return comma-delimited list of properties describing asset
    --i.e.:Property=Value unit;Property=Value unit;Property
    --Value Unit;(  
       @intInventoryId int,
       @chvProperties varchar(8000) output
    )declare  @intCountProperties int,
             @chvCounter int,
             @chvValue varchar(50),
             @chvUnit varchar(50),
             @insLenProperties smallintcreate table #Properties(
             Id int identity(1,1),
             property varchar(50),
             value varchar(50),
             Unit varchar(50))--identify Properties associated with assetinsert into #Properties (property,value,Unit)
         select Property,Value,Unit
         from InventoryPropery inner join Property
         on InventoryProperty.PropertyId=Property.Propertyid
         where InventoryProperty.InventoryId=@intInventoryId--set loopselect @intCountProperties=count(*),
           @intCounter=1,
           @chvProperties= ''
    from #Properites-- loop through list of properties
    while @intCounter<=@intCountProperties
    begin
      --get one property
        select @chvProperty=Property,
               @chvValue=value,
               @chvUnit=Unit
    From #Properties--check will new string fitselect @insLenProperty=DataLength(@chvProperty),
           @insLenValue=DataLenght(@chvValue),
           @insLenUnit=DataLenght(@chvUnit),
           @insLenProperties=DataLenght(@chvProperties)
    if @inslenProperties +2 + @insLenProperty
        +1 + @insLenValue+1+@insLenUnit>8000
    Begin 
          select 'List of Properties is too long'
                + '(over 8000 characters)!'
          return 1
    end--assemble list
    set @chvProperties= @chvProperties= ';'
                       + @chvProperty + '='
                       + @chvValue + ' '
                       + @chvUnit--let's go another round and get another property
    set @intCount =@intCounter=1
    end
    drop table #Properties
    return 0
      

  8.   

    用Web Service对ACCESS数据库进行操作,其他系统直接通过WebService来操作Access数据库.
      

  9.   

    我想问一下,用ado.net怎样连接!
      

  10.   

    的就是ADO.NET
    DBconn= new OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;DataSoure=Server.MapPath("/.../.../my.mdb;"))or:
    DBconn=new OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;")
      

  11.   

    看过一个说法,用sqlserver做前端。可以弄成cs模式访问access。
      

  12.   

    就是说没人用ACCESS数据库做C/S结构的??惨~~