Search code examples
c#asp.netcrystal-reports

Crystal Report is not showing data after some time


i already went through the following questions.please don't mark as duplicate to my question. https://stackoverflow.com/questions/24432683/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 keycode assembly, BusinessObjects.Licensing.KeycodeDecoder.dll, cannot be loaded. Any help will be greatly appreciated. thanks in adnvace.


Solution

  • After a long research my problem has been resolved by doing following changes in registry.Actually this issue is related to Print Job Limit which by default 75 I just extend its data size according to my requirement and it work for me.

    Go to-->RUN----->Regedit 1-HKEY_LOCAL_MACHINE 2-SOFTWARE 3-SAP BUSINESS OBJECT 4-CRYSTAL REPORT FOR .NET FRAMEWORK(your version no.) 5-REPORT APPLICATION SERVER 6-SERVER

    then got to "PrintJobLimit" PROPERTY and change its Data size to whatever you want. thanks for every one who help me in this