Home > DeveloperSection > Forums > Crystal Report is not showing data after some time
ben reitman
ben reitman

Total Post:96

Points:676
Posted on    March-31-2015 5:50 AM

 Crystal Report C#  Crystal Report 
Ratings:


 1 Reply(s)
 1233  View(s)
Rate this:

Crystal Report is not showing data after some time in CR version 13.0.2000.0 I am facing this issue since last 1 month. My crystal report are working fine development environment (windows-7 32bit, VS2010, Crystal report V.13). I deployed on server (windows server-2012 64bit, core i5). Problem is that after some time report getting blank. I search a lot about that and use Dispose (), Close () method, right now I’m using the following code.

 

public static void OpenPdfInBrowser(ReportClass RptReport)

{

        string strFilename;

        string strFolderName;

        string strFile = String.Empty;

        string strReportOutputName = String.Empty;

 

        HttpResponse objResponse = HttpContext.Current.Response;

        HttpSessionState objSession = HttpContext.Current.Session;

        HttpServerUtility objServer = HttpContext.Current.Server;

 

        strFolderName = objServer.MapPath("../ReportOutput");

        if (Directory.Exists(strFolderName) == false)

        {

            Directory.CreateDirectory(strFolderName);

        }

 

        //Generate the File Name

        strFilename = "";

        strFile = objSession.SessionID.ToString() + "_" + DateTime.Now.Ticks.ToString() + ".pdf";

        strFilename = strFolderName + "\\" + strFile;

 

        //Set the File Name

        DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();

        diskOpts.DiskFileName = strFilename;

 

        //Set the Various Options

        ExportOptions exportOpts = new ExportOptions();

        exportOpts = RptReport.ExportOptions;

        exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;

        exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat;

        exportOpts.DestinationOptions = diskOpts;

        //Export the Report

        RptReport.Export();

        //Stream it to the Client

        objResponse.ClearContent();

        objResponse.ClearHeaders();

        strReportOutputName = "Report";

        objResponse.ContentType = "application/pdf";

        objResponse.AddHeader("Content-Disposition", "inline;filename=Report.pdf");

        objResponse.WriteFile(strFilename);

        objResponse.Flush();

        objResponse.Close();

        //Delete the File  

        System.IO.File.Delete(strFilename);

        //Close the Report Object

        RptReport.Close();

        RptReport.Dispose();

        GC.Collect();

    }

 

   I am getting the following error in event viewer on deployment server.

The description for Event ID 4353 from source Crystal Reports cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

    If the event originated on another computer, the display information had to be saved with the event.

    The following information was included with the event:

The key code assembly, BusinessObjects.Licensing.KeycodeDecoder.dll, cannot be loaded. Any help will be greatly appreciated. Thanks in advance.



ezra heywood
ezra heywood

Total Post:145

Points:1019
Posted on    March-31-2015 7:04 AM

Your approach is correct to use .close and . dispose but the best way to use it is :

 Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload

    cryRpt.Close()

    cryRpt.Dispose()

End Sub

to open crystal report in PDF you can use http response it will be better in performance :

 

    cryRpt = New ReportDocument

    cryRpt.Load(Server.MapPath("Your report path"))

    cryRpt.SetDataSource(Your data source)

   cryRpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, True, "ExportedReport")

shareimprove this answer


Don't want to miss updates? Please click the below button!

Follow MindStick