EditingProgramThe long data connection string can't be remembered by the average person. Most people use it after finding the ready-made data on the Internet, but it is still very troublesome after all, sometimes I still cannot find a suitable solution at half past one. I accidentally found a very good solution on the internet today. It's really too convenient !!
- First, create a TXT text file named conn on the desktop, change the suffix to udl, and double-click it to open the corresponding dialog box.
- Next, we select the connection to be set. Here we select SQL Server
- Then, click "OK" to go to the server selection page and confirm the authentication method and database column.
If it is local, use Windows integrated authentication. If it is not local, use SQL authentication. After setting it, you can test the connection.
- If the connection is successful, a connection to the database is automatically generated in the conn file.Code, We only need to put this code in the database connection string.
For example, the string used for Windows Integrated Identity Authentication is:
[Oledb]
; Everything after this line is an ole db initstring
Provider = sqloledb.1; Integrated Security = sspi; persist Security info = false; user id = sa; Data Source = pcyx/sqlexpress
The SQL Server Authentication string is:
[Oledb]
; Everything after this line is an ole db initstring
Provider = sqloledb.1; Password = 111; persist Security info = true; user id = sa; Data Source = pcyx/sqlexpress