协议tcp/ip必然
dim DB_connstr="provider=sqloledb;Data Source=10.0.0.1;Initial Catalog=DBNAME;User Id=DB_USER;Password=YOU_DB_USER_PASSWORD"dim cn as new adodb.connection
cn.open DB_connstr

解决方案 »

  1.   

    文件dsn不知是否能够复制使用
    Set cn = Server.CreateObject("ADODB.Connection")
    'Open a connection; the string refers to the DSN
    cn.Open  "FILEDSN=MyDatabase.dsn"
      

  2.   

    如果您不想手工建立DSN,您可以将整个Connection String写在程序中。您还可以在Connection String指顶所要用的协议(如TCP/IP)。具体的方法,您可以参考以下文档:
    HOWTO: Set the SQL Server Network Library in an ADO Connection String (Q238949)
    (http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q238949) 
    - 微软全球技术中心 VB技术支持本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。