其他信息: 未能加载文件或程序集“file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll”或它的某一个依赖

今天在使用水晶报表的过程中,遇到了这个问题,下面是代码

FormReportView form = new FormReportView();
            ReportDocument rptc = new ReportDocument();
            string rptFile = Application.StartupPath + @"\report\PurchasingOrder.rpt";
            rptc.Load(rptFile);
            DataTable dt = OrderBL.SelectPurchasingPlanRpt(SysConfig.Storage, (int)cmb_plan_status.SelectedValue, dtpStart.Value, dtpEnd.Value);
            rptc.Database.Tables[0].SetDataSource(dt);//这行报错
            form.crystalReportViewer1.ReportSource = rptc;
            form.ShowDialog();

然后就懵了,求助百度,搜到了三篇文章,下面献上链接:

1)http://www.cnblogs.com/Aaxuan/p/6904134.html

 

2)http://www.cnblogs.com/xinyuyuanm/archive/2013/05/08/3067684.html

3)https://blog.csdn.net/zlbcdn/article/details/8925121?E0247F9612C0

按照上面说的,在app.config文件中加上了

<startup  useLegacyV2RuntimeActivationPolicy="true">
  <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>

真的就不报错了,但是还是不明白为什么。如果有大神知道,还请留言解惑,多多交流呀~,写这篇主要也是记录一下遇到的问题,便于以后查看。

posted @ 2019-03-14 15:04  闲得无聊敲代码  阅读(404)  评论(0编辑  收藏  举报