Dan Rigsby - Coding Up Style

.Net, C#, & Wcf Development

ConnectionString Tip of the Day

Posted by Dan Rigsby on December 21st, 2007

When creating a connection string it can be hard to remember all of the parameters to use.  You could use a resource like http://www.connectionstrings.com/, but even then its hard to simply test if it will work or not.  What if you have all of the connection information, but have forgotten the database name?

An easy way to solve all of this is to use a Microsoft Data Link file.  This is a file with the .udl extension.  You can create a file on your desktop or in a folder and just give it a name like "a.udl".  (The file itself doesn’t need to contain anything to be opened up in the data link properties window.)  Then, just double click on the file and will open up in the data link properties window like this:

image

You can now fill in the data you know and test connection at any time.  When you are done, just open up the .udl file in a text editor like notepad and it will contain the actual connection string.

image

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>