DataConnection Dialog

Here's how to display the DataConnection dialog at runtime allowing the user to define which datasource to connect.

ie. to display these :

ChooseDataSource

ConnectionProperties

 

In your project Add references to :

Microsoft.Data.ConnectionUI.dll
Microsoft.Data.ConnectionUI.Dialog.dll

You can find these under : <Visual Studio>\Common7\IDE folder.

Then in your code :

DataConnectionDialog dlg = new DataConnectionDialog();
DataSource.AddStandardDataSources(dlg);
switch (DataConnectionDialog.Show(dlg))
{
    case DialogResult.OK:
        textConnectionString.Text = dlg.ConnectionString;
        break;
}

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading



Search

Tags

None

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2009