PromptDataSource method

  • Thread starter Thread starter Coder
  • Start date Start date
C

Coder

When using Delphi, In order to create connection strings, there was a method
to show Data Source creation page,

string ConnStr = PromptDataSource();

What is the C# equivalent of this method ?

Thanks
 
Add a reference to Microsoft.Data.ConnectionUI. This is located in the
directory where VS is installed, eg:

C:\Program Files\VS8\Common7\IDE\Microsoft.Data.ConnectionUI.dll

Add the following code...

using Microsoft.Data.ConnectionUI;

....

Microsoft.Data.ConnectionUI.DataConnectionDialog dcd = new
Microsoft.Data.ConnectionUI.DataConnectionDialog();

Microsoft.Data.ConnectionUI.DataSource.AddStandardDataSources(dcd);

if (Microsoft.Data.ConnectionUI.DataConnectionDialog.Show(dcd)
== System.Windows.Forms.DialogResult.OK)
{
string buf = "Provider: " + dcd.SelectedDataProvider.Name +
"\r\n" + "ConnectionString: " + dcd.ConnectionString;
}

This is an undocumented method of displaying the same dialog that
VS.NET uses. But what the hack (I mean what the 'heck'). Some features
eventually find their way into a product when enough users use the hack
and Microsoft eventually catches on. This feature really should have
been in the product from day one. You listening MS?

Best Regards
Polaris431
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top