本文介绍了无法加载“Microsoft.Data.ConnectionUI”为DataConnectionDialog使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#,.Net 4.0中创建了一个应用程序。
在这个应用程序中,我需要显示一个DataConnectionDialog来访问DataBase。



我使用这个代码

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



在我的笔记本电脑上,代码运行正常,但在另一个laptot,.Net 4.0和.Net 4.5当我尝试打开此对话框时有一个异常:





但是,我在我的exe的同一目录中添加了这些DLL:

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

任何人都可以帮助我?如何更正此错误?



非常感谢,



最好的问候,



Nixeus

解决方案

从Nuget源获取这些库文件。




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 laptot, with .Net 4.0 and .Net 4.5 there is an Exception when i try to open this Dialog :

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 ?

Thanks a lot,

Best regards,

Nixeus

解决方案

You get these libraries files from Nuget source.

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

这篇关于无法加载“Microsoft.Data.ConnectionUI”为DataConnectionDialog使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 02:26