在 CrystalReport 中分配 DataSource 时发生 FileNotFoundException

3

本文介绍了在 CrystalReport 中分配 DataSource 时发生 FileNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

在报告中分配数据源时抛出 System.IO.FileNotFoundException execption.我正在使用 Visual Studio 2013、C# 4.5、WinForm 应用程序.我已经为 Visual Studio 13 安装了 Crystal Report.

System.IO.FileNotFoundException execption thrown while assigning data source in report. I am using visual studio 2013, C# 4.5, WinForm application. I have installed crystal report for visual studio 13.

这是代码

    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) 命令引发错误.

我认为这个错误是特定于版本的错误.

I think this error is version specific error.

异常详情:

System.IO.FileNotFoundException"类型的未处理异常发生在 mscorlib.dll 中

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

附加信息:无法加载文件或程序集'file:///C:Program FilesSAP BusinessObjectsCrystal Reports for .NET框架 4.0CommonSAP BusinessObjects Enterprise XI4.0win32_x86dotnet1crdb_adoplus.dll' 或其依赖项之一.系统找不到指定的文件.

Additional information: Could not load file or assembly 'file:///C:Program FilesSAP BusinessObjectsCrystal Reports for .NET Framework 4.0CommonSAP BusinessObjects Enterprise XI 4.0win32_x86dotnet1crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.

推荐答案

在您的配置中添加以下部分后重试:

Try again after adding below section in your config:

<startup uselegacyv2runtimeactivationpolicy="true">
  <supportedruntime version="v4.0" />
</startup>

这篇关于在 CrystalReport 中分配 DataSource 时发生 FileNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

C# 中的多播委托奇怪行为?
Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)...
2023-11-11 C#/.NET开发问题
6

参数计数与调用不匹配?
Parameter count mismatch with Invoke?(参数计数与调用不匹配?)...
2023-11-11 C#/.NET开发问题
26

如何将代表存储在列表中
How to store delegates in a List(如何将代表存储在列表中)...
2023-11-11 C#/.NET开发问题
6

代表如何工作(在后台)?
How delegates work (in the background)?(代表如何工作(在后台)?)...
2023-11-11 C#/.NET开发问题
5

没有 EndInvoke 的 C# 异步调用?
C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)...
2023-11-11 C#/.NET开发问题
2

Delegate.CreateDelegate() 和泛型:错误绑定到目标方法
Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)...
2023-11-11 C#/.NET开发问题
14