Basic database connection string C# and Sql Server using UDL file


Back to learning
Created: 15/06/2013

Basic database connection string C# and Sql Server using UDL file

This is a simple way to get proper database connection String to use in your project.

Microsoft Sql Server

1) First i show my Sql Server databse



2) Open notepad.exe and save empty file like "All files" and "conn.UDL" file



3) After creation of your file double click and in the first flap select Microsoft OLE DB Provider for SQL Server




4) In the second flap select your Sql Server name, then press Use Windows NT Integrated security, and finally select your DataBase from the selected Server




5) If you whant you can test the options that you have selected, like here below.


6) After all, open that file with simple notepad.exe and copy all the created string, so you can use it in your project.


7) You can delete the first parameter, Provider=SQLOLEDB.1;

Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=tests;Data Source=MAK-PC\MSSQLSERVER2008

Result: 
Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=tests;Data Source=MAK-PC\MSSQLSERVER2008


Hope this helps somebody!
Let me your comment.