winforms connection properties dialog for configuration string
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 :
I just tried it, it works fine :)
Update 7/2019
Since the Microsoft Code site is dark, and there doesn't seem to be an official Microsoft posting for Data Connection Dialog
, here is a link to a Github user repository with the Microsoft code.
https://github.com/kjbartel/ConnectionDialog
Original but now dead link http://code.msdn.microsoft.com/Connection
Look for this article explaining exactly what are you looking for. What she say is the following:
You will need to add a couple references to your project:
- OLE DB Service Component 1.0 Type Library
- Microsoft ActiveX Data Objects 2.x Library
Use the following code:
using MSDASC; using ADODB; private string BuildConnectionString() { string strConnString = ""; object _con = null; MSDASC.DataLinks _link = new MSDASC.DataLinks(); _con = _link.PromptNew(); if (_con == null) return string.Empty; strConnString = ((ADODB.Connection)_con).ConnectionString; return strConnString; }
It's quite old, but there's this article - might have some inspiration for you.
I don't know if there exists a 'predefined' form for it, but, you could offcourse create your own form, and use one the DbConnectionStringBuilder classes (SqlConnectionStringBuilder, OracleConnectionStringBuilder, OleDbConnectionStringBuilder) to create the connectionstring from the parameters the user entered on your custom created form.