SQL native client ODBC driver
Standard secure connection
Driver = {SQL native client}; server = myserveraddress; database = mydatabase; uid = myusername; Pwd = mypassword;
Are you using SQL Server 2005 Express? Use the connection expression "host name \ sqlexpress" in the "server" option ".
Trusted connection
Driver = {SQL native client}; server = myserveraddress; database = mydatabase; trusted_connection = yes;
\ "Integrated Security = sspi \" is the same as \ "trusted_connection = Yes.
Connect to an SQL server instance
The expression of the specified server instance is the same as the connection string of other SQL servers.
Driver = {SQL native client}; server = myservername \ theinstancename; database = mydatabase; trusted_connection = yes;
User name and password
Oconn. properties (\ "prompt \") = adpromptalways
Driver = {SQL native client}; server = myserveraddress; database = mydatabase;
Use Mars (multiple active result sets)
Driver = {SQL native client}; server = myserveraddress; database = mydatabase; trusted_connection = yes; mars_connection = yes;
\ "Multipleactiveresultsets = true \" is the same as mars_connection = Yes.
Use ADO. NET 2.0 as the module of Mars. Mars does not support ADO. NET 1.0 and ADO. NET 1.1.
Verify Network Data
Driver = {SQL native client}; server = myserveraddress; database = mydatabase; trusted_connection = yes; encrypt = yes;
Connect to the local SQL Server express instance by attaching a local database file
Driver = {SQL native client}; server =. \ sqlexpress; attachdbfilename = c: \ ASD \ qwe \ mydbfile. MDF; database = dbname; trusted_connection = yes;
Why use database parameters? If a database with the same name has been attached, SQL server will not attach it again.
Connect to the local SQL Server express instance by attaching a database file in the local data folder
Driver = {SQL native client}; server =. \ sqlexpress; attachdbfilename = | datadirectory | mydbfile. MDF; database = dbname; trusted_connection = yes;
Why use database parameters? If a database with the same name has been attached, SQL server will not attach it again.
Database image
Data Source = myserveraddress; failover partner = mymirrorserver; initial catalog = mydatabase; Integrated Security = true;
SQL native client OLE DB Provider
Standard connection
Provider = sqlncli; server = myserveraddress; database = mydatabase; uid = myusername; Pwd = mypassword;
Are you using SQL Server 2005 Express? Use the connection expression "host name \ sqlexpress" in the "server" option ".
Trusted connection
Provider = sqlncli; server = myserveraddress; database = mydatabase; trusted_connection = yes; [Page]
\ "Integrated Security = sspi \" is the same as \ "trusted_connection = Yes \"
Connect to an SQL server instance
The expression of the specified server instance is the same as the connection string of other SQL servers.
Provider = sqlncli; server = myservername \ theinstancename; database = mydatabase; trusted_connection = yes;
Use account and password
Oconn. properties (\ "prompt \") = adpromptalways
Oconn. Open \ "provider = sqlncli; server = myserveraddress; database = mydatabase;
Use Mars (multiple active result sets)
Provider = sqlncli; server = myserveraddress; database = mydatabase; trusted_connection = yes; marsconn = yes;
\ "Multipleactiveresultsets = true \" and \ "mars_connection = Yes \" are the same.
Use ADO. NET 2.0 as the module of Mars. Mars does not support ADO. NET 1.0 and ADO. NET 1.1.
Verify Network Data
Provider = sqlncli; server = myserveraddress; database = mydatabase; trusted_connection = yes; encrypt = yes;
Connect to the local SQL Server express instance by attaching a local database file
Provider = sqlncli; server =. \ sqlexpress; attachdbfilename = c: \ ASD \ qwe \ mydbfile. MDF; database = dbname; trusted_connection = yes;
Why use database parameters? If a database with the same name has been attached, SQL server will not attach it again.
Connect to the local SQL Server express instance by attaching a database file in the local data folder
Provider = sqlncli; server =. \ sqlexpress; attachdbfilename = | datadirectory | mydbfile. MDF; database = dbname; trusted_connection = yes;
Why use database parameters? If a database with the same name has been attached, SQL server will not attach it again.
Database image
Data Source = myserveraddress; failover partner = mymirrorserver; initial catalog = mydatabase; Integrated Security = true;
Sqlconnection (. NET)
Standard connection
Data Source = myserveraddress; initial catalog = mydatabase; user id = myusername; Password = mypassword;
You can use servername \ InstanceName as the data source to specify an SQL server instance.
Are you using SQL Server 2005 Express? Use the connection expression "host name \ sqlexpress" in the "server" option ".
Posted @ jiania read (...) Comments (...) EDIT favorites
Refresh comment refresh page Back to Top
Blog homepage blog news flash programmer recruitment Knowledge Base
Copyright 2013 jiania