I decided to repost one of my original blog posts on how to easily build and test your connection strings that was quite popular and somehow lost during the transition to the new site. This method is fairly simple and I use it all the time when I need to build or test out a new connection string. The first thing you need to do is create a new empty file and call it Test.udl. Normally I use Notepad to do this, but you can use anything you want.
Once you have done this your file will display the computer icon associated with .udl files and if you double click on the file it will open up the Data Link Properties window.
Next, you need to fill out your connection information including provider, server, database, and login information. In order to properly get your connection string you will need to check the allow saving password box. At this point you can click the test connection button to verify that the connection is successful. If it is not, you can continue to make adjustments to the Data Link Properties window until it is.
Finally, click OK to save the file, and open up the .udl file using Notepad. If you did check the allow saving password box you will be cautioned about the security risk of saving the password. Once you’ve opened the file you will see something similar to the follow:
[oledb]
; Everything after this line is an OLE DB initstring
Provider=SQLOLEDB.1;Password=yourpassword;Persist Security Info=True;User ID=sa;Initial Catalog=TimeTracker;Data Source=WDMPDC01
You have now created your connection string and can copy and paste this into your application. This is also an excellent way of testing connectivity issues from individual computers.
Did you find this posting helpful? Please let me know by posting a comment.