资源预览内容
第1页 / 共32页
第2页 / 共32页
第3页 / 共32页
第4页 / 共32页
第5页 / 共32页
第6页 / 共32页
第7页 / 共32页
第8页 / 共32页
第9页 / 共32页
第10页 / 共32页
亲,该文档总共32页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
.专业整理.SQL Server ODBC standard Security:Driver=SQL Server;Server=Aron1;Database=pubs;Uid=sa;Pwd=asdasd; trusted connection:Driver=SQL Server;Server=Aron1;Database=pubs;Trusted_Connection=yes; prompt for username and password:oConn.Properties(Prompt) = adPromptAlwaysoConn.Open Driver=SQL Server;Server=Aron1;DataBase=pubs; OLE DB, OleDbConnection (.NET) standard Security:Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd; trusted Connection:Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI; (use serverNameinstanceName as Data Source to use an specifik SQLServer instance, only SQLServer2000)prompt for username and password:oConn.Provider = sqloledboConn.Properties(Prompt) = adPromptAlwaysoConn.Open Data Source=Aron1;Initial Catalog=pubs; connect via an IP address:Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd; (dbmssocn=tcp/ip instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default)SqlConnection (.NET) standard Security:Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd; - or -Server=Aron1;Database=pubs;User ID=sa;Password=asdasd;Trusted_Connection=False (booth connection strings produces the same result)trusted Connection:Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI; - or -Server=Aron1;Database=pubs;Trusted_Connection=True; (booth connection strings produces the same result)(use serverNameinstanceName as Data Source to use an specifik SQLServer instance, only SQLServer2000)connect via an IP address:Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd; (dbmssocn=tcp/ip instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default)declare the SqlConnection:C#:using System.Data.SqlClient;SqlConnection oSQLConn = new SqlConnection();oSQLConn.ConnectionString=my connectionstring;oSQLConn.Open(); VB.NET:Imports System.Data.SqlClientDim oSQLConn As SqlConnection = New SqlConnection()oSQLConn.ConnectionString=my connectionstringoSQLConn.Open() Data Shape ms Data ShapeProvider=MSDataShape;Data Provider=SQLOLEDB;Data Source=Aron1;Initial Catalog=pubs;User ID=sa;Password=asdasd; want to learn data shaping? Check out 4GuyfFromRollas great article about Data Shaping Read more How to define which network protocol to useExample:Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd; Name Network library dbnmpntw Win32 Named Pipes dbmssocn Win32 Winsock TCP/IP dbmsspxn Win32 SPX/IPX dbmsvinn Win32 Banyan Vines dbmsrpcn Win32 Multi-Protocol (Windows RPC) important note! When connecting through the SQLOLEDB provider use the syntax Network Library=dbmssocnand when connecting through MSDASQL provider use the syntax Network=dbmssocn All SqlConnection connectionstring propertiesThis table shows all connectionstring properties for the ADO.NET SqlConnection object. Most of the properties are also used in ADO. All properties and descriptions is from msdn. Name Default Description Application Name The name of the application, or .Net SqlClient Data Provider if no application name is provided. AttachDBFilename-or-extended properties-or-Initial File Name The name of the primary file, including the full path name, of an attachable database. The database name must be specified with the keyword database. Connect Timeout-or-Connection Timeout 15 The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error. Connection Lifetime 0 When a connection is returned to the pool, its creation time is compared with the current time, and the connection is destroyed if that time span (in seconds) exceeds the value specified by connection lifetime. Useful in clustered configurations to force load balancing between a running server and a server just brought on-line. Connection Reset true Determines whether the database connection is reset when being removed from the pool. Setting to false avoids making an additional server round-trip when obtaining a connection, but the programmer must be aware that the connection state is not being reset. Current Language The SQL Server Language record name. Data Source-or-Server-or-Address-or-Addr-or-Network Address The name or network address of the instance of SQL Server to which to connect. Enlist true When true, the pooler automatically enlists the connection in the creation threads current transaction context. Initial Catalog-or-Database The name of the database.
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号