在报告中分配数据源时抛出 System.IO.FileNotFoundException 异常。 我正在使用 visual studio 2013、C# 4.5、WinForm 应用程序。我已经为 Visual Studio 13 安装了 Crystal Report。
这是代码
DataSet ds = new DataSet();
ds.Tables.Add(new DataTable("administration_CashDeskManager_Reports_ReportDataBusinessObject"));
ds.Tables.Add(new DataTable("administration_CashDeskManager_Reports_ReportDataDetailBusinessObject"));
Reports.CrystalReport.rptCashDeskTransactionLog Report = new Reports.CrystalReport.rptCashDeskTransactionLog();
Report.SetDataSource(ds);
crViewer.ReportSource = Report;
Report.SetDataSource(ds) 命令引发错误。
我认为这个错误是特定于版本的错误。
异常详细信息:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
Additional information: Could not load file or assembly 'file:///C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.
最佳答案
在您的配置中添加以下部分后重试:
<startup uselegacyv2runtimeactivationpolicy="true">
<supportedruntime version="v4.0" />
</startup>
关于c# - 在 Crystal Report 中分配 DataSource 时发生 FileNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23774260/