Display a ConnectionString dialog

Viewed 26460

I'm trying to create a program in C# that should be able to create, backup and restore a SQL Server database.

For this, the user needs to be able to setup a connection string to the desired SQL Server (and database).

I would like to use the same dialog as for example Visual Studio for creating the connection string.

Is this possible?

8 Answers

I think all the other answers here are out-of-date, but I found a current solution at code.msdn.microsoft.com:

Using Microsoft Visual Studio Connection Dialog at runtime

In Visual Studio when a developer wants to create strong typed classes for database tables either for the conventional TableAdapter or Entity Framework there is a place in the process where a dialog is displayed as shown below. I will show you how to do this at runtime and a bit more.

The download is a solution that builds the following dlls:

  • Microsoft.Data.ConnectionUI.Dialog.dll

  • Microsoft.Data.ConnectionUI.dll

  • Microsoft.Data.DataConnectionConfiguration.dll

The solution also contains a sample application showing how to use them. Worked a treat for me and it is super easy.

Related