- August
Posted By : Alexander Goida
Database Connection Dialog

Implementation of a database connection dialog with full set of features which you can see when look at the same dialog in  is not the easiest tasks. It includes many aspects such as servers enumeration and database enumeration. Visual Studio SDK allows you to create such a dialog in several minutes.

I’m talking about well-known standard dialog which Visual Studio and some other applications have. It looks like this:

First of all, you need to add DLL library Microsoft.Data.ConnectionUI.Dialog.dll  to references of your project. It could be found in C:\Program Files\Microsoft Visual Studio 8\Common7\IDE  if your version of VS was installed with default settings.
This is the simplest code to launch the dialog:

If you run this code you’ll see a dialog asking you to choose a data source to go ahead to the next step.

For some reason we might already know which data source we want use for a connection. In such a case we can specify it exactly before launch the dialog. See the following code:

If you run this code you’ll see the dialog box which is present on the first picture for this topic.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.