C# – Crystal Reports for Visual Studio 2010 Error

asp.net-4.0ccrystal-reportsvisual studio 2010

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, version for Visual Studio 2010 – Standard EXE installation package which installs the software into the Visual Studio IDE.

2) SAP Crystal Reports runtime engine for .NET Framework 4 (64-bit)

I have a page called Reports.aspx in which I have a crystal report viewer control

 <CR:CrystalReportViewer ID="rptViewer" runat="server" AutoDataBind="true" />

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;
}

On the report.Load(path) line I get the following error:

Unsupported Operation. A document processed by the JRC engine cannot be opened in the C++ stack.

How can I fix this?

Best Answer

I also got into the same problem my problem was report path was not valid, May be you have same problem , check Server.MapPath("Reports/Sample.rpt") returning valid path ?