数据连接串之sql server
更新时间:2007年03月06日 00:00:00 作者:
SQL Server Set your custom connection string values
This is a compiled connection strings reference list on how to connect to SQL Server.
ODBC
Standard Security
Driver={SQL Server};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Trusted connection
Driver={SQL Server};Server=myServerAddress;Database=myDataBase;Trusted_Connection=Yes;
Prompt for username and password
This one is a bit tricky. First you need to set the connection object's Prompt property to adPromptAlways. Then use the connection string to connect to the database.
oConn.Properties("Prompt") = adPromptAlways
Driver={SQL Server};Server=myServerAddress;Database=myDataBase;
OLE DB, OleDbConnection (.NET)
Standard Security
Provider=sqloledb;Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
Trusted connection
Provider=sqloledb;Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
Use serverName\instanceName as Data Source to use a specific SQL Server instance. Please note that the multiple SQL Server instances feature is available only from SQL Server version 2000 and not in any previous versions.
Prompt for username and password
This one is a bit tricky. First set the connection object's Provider property to "sqloledb". Thereafter set the connection object's Prompt property to adPromptAlways. Then use the connection string to connect to the database.
oConn.Provider = "sqloledb"
oConn.Properties("Prompt") = adPromptAlways
Data Source=myServerAddress;Initial Catalog=myDataBase;
Connect via an IP address
Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
DBMSSOCN=TCP/IP. This is how to use TCP/IP instead of Named Pipes. At the end of the Data Source is the port to use. 1433 is the default port for SQL Server.
How to define which network protocol to use >>
SqlConnection (.NET)
Standard Security
Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
Standard Security alternative syntax
This connection string produce the same result as the previous one. The reason to include it is to point out that some connection string keywords have many equivalents.
Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False;
Trusted Connection
Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
Trusted Connection alternative syntax
This connection string produce the same result as the previous one. The reason to include it is to point out that some connection string keywords have many equivalents.
Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
Use serverName\instanceName as Data Source to use a specific SQL Server instance. Please note that the multiple SQL Server instances feature is available only from SQL Server version 2000 and not in any previous versions.
Connect via an IP address
Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
DBMSSOCN=TCP/IP. This is how to use TCP/IP instead of Named Pipes. At the end of the Data Source is the port to use. 1433 is the default port for SQL Server.
How to define which network protocol to use >>
Specifying packet size
Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False;Packet Size=4096;
By default, the Microsoft .NET Framework Data Provider for SQL Server sets the network packet size to 8192 bytes. This might however not be optimal, try to set this value to 4096 instead.
The default value of 8192 might cause errors as well ("Failed to reserve contiguous memory"), check this out >>
Data Shape
MS Data Shape
Provider=MSDataShape;Data Provider=SQLOLEDB;Data Source=myServerAddress;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
http://www.connectionstrings.com/?carrier=sqlserver
This is a compiled connection strings reference list on how to connect to SQL Server.
ODBC
Standard Security
复制代码 代码如下:
Driver={SQL Server};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Trusted connection
复制代码 代码如下:
Driver={SQL Server};Server=myServerAddress;Database=myDataBase;Trusted_Connection=Yes;
Prompt for username and password
This one is a bit tricky. First you need to set the connection object's Prompt property to adPromptAlways. Then use the connection string to connect to the database.
复制代码 代码如下:
oConn.Properties("Prompt") = adPromptAlways
Driver={SQL Server};Server=myServerAddress;Database=myDataBase;
OLE DB, OleDbConnection (.NET)
Standard Security
复制代码 代码如下:
Provider=sqloledb;Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
Trusted connection
复制代码 代码如下:
Provider=sqloledb;Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
Prompt for username and password
This one is a bit tricky. First set the connection object's Provider property to "sqloledb". Thereafter set the connection object's Prompt property to adPromptAlways. Then use the connection string to connect to the database.
复制代码 代码如下:
oConn.Provider = "sqloledb"
oConn.Properties("Prompt") = adPromptAlways
Data Source=myServerAddress;Initial Catalog=myDataBase;
Connect via an IP address
复制代码 代码如下:
Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
DBMSSOCN=TCP/IP. This is how to use TCP/IP instead of Named Pipes. At the end of the Data Source is the port to use. 1433 is the default port for SQL Server.
How to define which network protocol to use >>
SqlConnection (.NET)
Standard Security
复制代码 代码如下:
Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
Standard Security alternative syntax
This connection string produce the same result as the previous one. The reason to include it is to point out that some connection string keywords have many equivalents.
复制代码 代码如下:
Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False;
Trusted Connection
复制代码 代码如下:
Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
Trusted Connection alternative syntax
This connection string produce the same result as the previous one. The reason to include it is to point out that some connection string keywords have many equivalents.
复制代码 代码如下:
Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
Connect via an IP address
Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
DBMSSOCN=TCP/IP. This is how to use TCP/IP instead of Named Pipes. At the end of the Data Source is the port to use. 1433 is the default port for SQL Server.
How to define which network protocol to use >>
Specifying packet size
复制代码 代码如下:
Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False;Packet Size=4096;
By default, the Microsoft .NET Framework Data Provider for SQL Server sets the network packet size to 8192 bytes. This might however not be optimal, try to set this value to 4096 instead.
The default value of 8192 might cause errors as well ("Failed to reserve contiguous memory"), check this out >>
Data Shape
MS Data Shape
复制代码 代码如下:
Provider=MSDataShape;Data Provider=SQLOLEDB;Data Source=myServerAddress;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
http://www.connectionstrings.com/?carrier=sqlserver
相关文章
批量隐藏程序窗口 SuchSofts TskillPlus 2.2 下载
批量隐藏程序窗口 SuchSofts TskillPlus 2.2 下载...2007-04-04硬盘监控工具 HDDlife Pro v2.9.110 +汉化版 下载
硬盘监控工具 HDDlife Pro v2.9.110 +汉化版 下载...2007-04-04Red Hat 红帽企业Linux 5 SERVER 正式版 迅雷下载地址
Red Hat 红帽企业Linux 5 SERVER 正式版 迅雷下载地址...2007-11-11数码冲相店管理系统 2006 build 2006.5 注册破解版 下载
数码冲相店管理系统 2006 build 2006.5 注册破解版 下载...2007-10-10压缩软件 7-Zip v4.45 Alpha 1 免费英文版 下载
压缩软件 7-Zip v4.45 Alpha 1 免费英文版 下载...2007-03-03图像浏览软件 ACDSee Photo Manager v9.0 Build 108 下载
图像浏览软件 ACDSee Photo Manager v9.0 Build 108 下载...2007-03-03
最新评论