我正在尝试从使用 ASP.NET 4.0 和 Visual Studio 2010 构建的 Web 应用程序运行水晶报表.我已经从 SAP 站点安装了以下内容 (http://www.businessobjects.com/jump/xi/crvs2010/us2_default.asp)
I am trying to run a crystal report from my web application which was built using ASP.NET 4.0 and Visual Studio 2010. I have installed the following from the SAP site (http://www.businessobjects.com/jump/xi/crvs2010/us2_default.asp)
1) SAP Crystal Reports,Visual Studio 2010 版 - 将软件安装到 Visual Studio IDE 中的标准 EXE 安装包.
1) SAP Crystal Reports, version for Visual Studio 2010 - Standard EXE installation package which installs the software into the Visual Studio IDE.
2) 适用于 .NET Framework 4(64 位)的 SAP Crystal Reports 运行时引擎
2) SAP Crystal Reports runtime engine for .NET Framework 4 (64-bit)
我有一个名为 Reports.aspx 的页面,其中有一个水晶报表查看器控件
I have a page called Reports.aspx in which I have a crystal report viewer control
<CR:CrystalReportViewer ID="rptViewer" runat="server" AutoDataBind="true" />
在 Reports.aspx.cs 文件中我有以下代码:
In the Reports.aspx.cs file I have the following code:
protected override void OnPreRender(EventArgs e)
{
ReportDocument report = new ReportDocument();
var path = Server.MapPath("Reports/Sample.rpt");
report.Load(path);
report.SetDatabaseLogon("username", "password", "servername", "databasename");
rptViewer.ReportSource = report;
}
在 report.Load(path) 行我收到以下错误:
On the report.Load(path) line I get the following error:
不支持的操作.JRC 引擎处理的文档无法在 C++ 堆栈中打开.
我该如何解决这个问题?
How can I fix this?
确保报告在 app_code
文件夹中初始化它的新实例,而不是初始化报表文档并将报表加载到其中.
make sure the report is in app_code
folder
initialize a new instance of it instead of initializing a reportdocument and loading the report in it.
Sample report = new Sample();
这对我有用
这篇关于用于 Visual Studio 2010 错误的 Crystal Reports的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!