Search code examples
c#.netdatabase-connectionsqlconnection

Unable to load 'Microsoft.Data.ConnectionUI" for DataConnectionDialog use


I created an application in C#, .Net 4.0. In this application i need to show a DataConnectionDialog for accessing DataBase.

I use this code :

 DataConnectionDialog BDdialog = new DataConnectionDialog();
 DataSource.AddStandardDataSources(BDdialog);
 BDdialog.SelectedDataSource = DataSource.OdbcDataSource;
 BDdialog.SelectedDataProvider = DataProvider.OdbcDataProvider;
 DataConnectionDialog.Show(BDdialog);

On my laptop, the code works fine, but on another laptop, with .Net 4.0 and .Net 4.5 there is an Exception when I try to open this dialog :

enter image description here

Nevertheless, I added these DLL in the same directory of my exe :

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

Anyone could help me? How correcting this error please?


Solution

  • You get these libraries files from Nuget source.

    https://nuget.org/packages/DataConnectionDialog/1.2