1、联接SQL Server
A、ODBC 方式
Standard Security方式:"Driver={SQL Server};Server=Aron1;Database=pubs;Uid=sa;Pwd=asdasd;"
Trusted 方式:"Driver={SQL Server};Server=Aron1;Database=pubs;Trusted_Connection=yes;"
需要提示的:
oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Driver={SQL Server};Server=Aron1;DataBase=pubs;"
B、OLE DB, OleDbConnection (.NET) 方式
Trusted 方式:"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
需要提示的:
oConn.Provider = "sqloledb"
oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Data Source=Aron1;Initial Catalog=pubs;"
联接网络数据库:
"Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;"
C、SqlConnection (.NET)方式
Standard Security方式:"Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;"
或"Server=Aron1;Database=pubs;User ID=sa;Password=asdasd;Trusted_Connection=False"
Trusted 方式:"Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
或"Server=Aron1;Database=pubs;Trusted_Connection=True;"
联接网络数据库:
A、ODBC 方式
Standard Security方式:"Driver={SQL Server};Server=Aron1;Database=pubs;Uid=sa;Pwd=asdasd;"
Trusted 方式:"Driver={SQL Server};Server=Aron1;Database=pubs;Trusted_Connection=yes;"
需要提示的:
oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Driver={SQL Server};Server=Aron1;DataBase=pubs;"
B、OLE DB, OleDbConnection (.NET) 方式
Trusted 方式:"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
需要提示的:
oConn.Provider = "sqloledb"
oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Data Source=Aron1;Initial Catalog=pubs;"
联接网络数据库:
"Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;"
C、SqlConnection (.NET)方式
Standard Security方式:"Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;"
或"Server=Aron1;Database=pubs;User ID=sa;Password=asdasd;Trusted_Connection=False"
Trusted 方式:"Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
或"Server=Aron1;Database=pubs;Trusted_Connection=True;"
联接网络数据库:
"Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;"
本文转自kenty博客园博客,原文链接http://www.cnblogs.com/kentyshang/archive/2006/11/29/576054.html如需转载请自行联系原作者
kenty