load report failed

2019-09-01 17:58发布

问题:

Load report failed this error logged when i try to open Crystal report and if i restart my iis (iisreset) then it's working.

Here's my code:

Dim objReport As New CrystalDecisions.CrystalReports.Engine.ReportClass
Dim location As String = context.Server.MapPath("../POC/POC1.rpt")
objReport.FileName = location
objReport.Load()
objReport.SetDataSource(dsPOC)

What could be the problem?

回答1:

Try this...it will give you the perfect idea....

using System;using CrystalDecisions.CrystalReports.Engine;using CrystalDecisions.Shared;namespace Report
 {       public partial class Report : Document    
  {       public void ReportLoad()    
   {             ReportDocument reportDocument = new ReportDocument();       
 string filePath = "C:\Projects\Application\Report\CrystalReport.rpt";            reportDocument.Load(filePath);  
          crystalReportViewer.ReportSource = reportDocument; 
      }   
}}  


回答2:

If you are using VB.net as a code behind use this sample code for loading crystal report.



回答3:

Thanks for your response. Now the problem solved by objReport.Dispose(). I called this Dispose Method after appending each document. The problem might be i failed to release data form memory.

regards, saj