views:

730

answers:

3

I like the "Add Connection" or "SQL Connection" dialog that is in Visual Studio in Server Explorer window. I also like the one in CodeSmith. I would like to have that same dialog or simular functionality in my windows application.

I need it to work with SQL Server, and SQL Server Express Database files (*.mdf).

My clients have .NET 3.5 SP1 and SQL Server 2008 Express installed.

Is this a system dialog I can use? Is there an open source dialog like it? Thanks.

A: 

You would have to implement it yourself. It comes as part of the installtion of VS.NET, and if you were to access it, I am sure the EULA would require a license for VS.NET on every machine you ran this on.

That being said, you will have to implement this yourself. Unfortunately, Google turns up nothing when queried for an open source add connection dialog.

casperOne
Sorry, I made a mistake when I was going to add a link to my post and ended up adding it to your post. (I didnt even know I could edit others posts.) Now I know...
Stefan
+1  A: 

Here you go:
SQL Connection Dialog
http://www.codeproject.com/KB/vb/SQL_Connection_Dialog.aspx

Edit:
It seems that the above example is using MSDASC.DataLinks.ui wich is not allowed to redistribute.

There are a request of making the MSDASC.DataLinks ui distributable: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=291885

So it will only work if the end user has VS installed. Not good enough. I will not delete this answer because of the project is still a good start if you want to make your own dialog.

Edit 2:
More on the subject:
Using the Choose Data Source dialog of Visual Studio 2005 from your own code
http://www.mztools.com/articles/2007/MZ2007011.aspx and http://www.clariusconsulting.net/blogs/kzu/archive/2006/03/01/ReferenceRelativePath.aspx

Stefan
+2  A: 

I was looking for exactly that, and it appears that Microsoft has published the source for the Visual Studio connection dialog, so that it can be used outside VS :

http://code.msdn.microsoft.com/Connection

I just tried it, it works fine :)

Thomas Levesque
This is perfect. Thanks.
Bobby Ortiz