I have never been very familiar with the differences between the keywords in connectionstring, so it is too cumbersome to die.
Let's explain some of the insights ......
**************************************** ***********
What is the difference between initial catalog and database?
Initial Catalog; DataBase:In fact, there is no difference between the two, but the names are different, just like the real names of human beings and the old names .. Can call you.
**************************************** ****
Integrated Security = SSPI indicates that the current WINDOWS system user logs on to the SQL server. If the SQL SERVER does not support this method, an error occurs.
You can use the username and password of SQL SERVER to log on, for example:
"Provider = SQLOLEDB.1; Persist Security Info = False; Initial Catalog = database name; Data Source = 192.168.0.1; User ID = sa; Password = Password"
**************************************** ***********
If the value of Integrated Security-or-Trusted_Connection 'false' is false, the user ID and password are specified in the connection. If this parameter is set to true, the current Windows Account creden。 are used for authentication. The identifiable values are true, false, yes, no, and sspi equivalent to true (strongly recommended ).
**************************************** *********
Database Connection Method in ADO.net
System. Data. SqlClient. SqlConnection
Commonly used connection strings (C # code ):
Copy codeThe Code is as follows:
SqlConnection conn = new SqlConnection ("Server = (local); Integrated Security = SSPI; database = Pubs");
SqlConnection conn = new SqlConnection ("server = (local) \ NetSDK; database = pubs; Integrated Security = SSPI");
SqlConnection conn = new SqlConnection ("Data Source = localhost; Integrated Security = SSPI; Initial Catalog = Northwind;");
SqlConnection conn = new SqlConnection ("data source = (local); initial catalog = xr; integrated security = SSPI;
Persist security info = False; workstation id = XURUI; packet size = 4096; ");
SqlConnection myConn = new System. Data. SqlClient. SqlConnection ("Persist Security Info = False; Integrated
Security = SSPI; database = northwind; server = mySQLServer ");
SqlConnection conn = new SqlConnection ("uid = sa; pwd = passwords; initial catalog = pubs; data source = 127.0.0.1; Connect Timeout = 900");