Generate Connection String using UDL file

Many of the times you might be spent more time to build the connection string and again fixing the issues of it when wrong details are provided.

Here I’m going to show the simple tip to generate the connecting string without having any issues.
Open notepad and save it to desktop (or somewhere) with extension UDL (Universal Data Link) as shown below:
Connection String UDL


Now double click on “MyConnectionString.udl” file to open Data Link Properties as shown below. You might be already aware of this dialog in your daily programming.
Data Link Properties


Click on ‘Test Connection’ button by filling the server name and login details. If valid details are given, you will get connection succeed dialog as shown below
Data Link Properties Connection Succeed



After that choose the database and click on OK. Now open the .UDL file in notepad and you will find the connection string there.
Connection String Ready

Copy the connection string to your program or configuration file as highlighted in the above picture and start using it without any issues.
Hope you got the tip on generating the connection string in simplest way.


No comments:

Powered by Blogger.