Load Report Failed

Posted on 2006-04-28
Last Modified: 2012-05-05
I have a .Net application that uses Crystal Reports v10.  It prints a lot of reports automatically throughout the day.  It'll run fine for a while, sometimes days - printing reports just fine, then all of a sudden it'll stop working.  The error says "Load Report Failed".  The application runs as a service, with the error messsages written to the event log.  The only way to get it to work again is to unload the service and reload it.  Then it'll work fine.  

The application was originally written with the RPT as an embedded resource.  In trying to resolve the problem I changed that to reference an external file but I still have the same problem.  This occurs on multiple systems.

Can anyone help with this?  I'm thinking it has to do with the fact that I print so may reports in a day (maybe 100+).  Everything must be installed correctly or it wouldn't ever work at all.  

Printing is done via the printInvestigationSheet method, which I have copied below (C#):

public bool printInvestigationSheet(string orderID, string store, DateTime OrderDate, DataAccessLayerBaseClass DBLayer) {
      try {
            ReportDocument crReportDocument = new ReportDocument();
            crReportDocument.Load(Application.StartupPath + @"\investigation.rpt");
            foreach (Table crTable in crReportDocument.Database.Tables) {
                  TableLogOnInfo crTableLogOnInfo = crTable.LogOnInfo;
                  crTableLogOnInfo.ConnectionInfo.ServerName = Preferences.DBServer;
                  crTableLogOnInfo.ConnectionInfo.DatabaseName = Preferences.DBName;
                  crTableLogOnInfo.ConnectionInfo.UserID = Preferences.databaseUserID;
                  crTableLogOnInfo.ConnectionInfo.Password = Preferences.databasePassword;
                  crTable.Location = crTableLogOnInfo.ConnectionInfo.DatabaseName + ".dbo." + crTable.Location.Substring(crTable.Location.LastIndexOf(".") + 1);
            crReportDocument.RecordSelectionFormula = "{Orders.OrderID} = '" + orderID + "' and {Orders.Store} = '" + store + "' and {Orders.OrderDate} >= #" + OrderDate.ToString("MM/dd/yyyy") + "#";
            crReportDocument.PrintOptions.PrinterName = Preferences.defaultPrinter;
            crReportDocument.PrintToPrinter(1, true, 0, 0);
            // If the document printed successfully, set a flag in the database indicating so
            DBLayer.setInvestigationSheetPrinted(orderID, store, OrderDate);
            return true;
      } catch (Exception e) {
            // This is where the "Load Report Failed" error is raised and written to the eventlog.
            MessageHandler.getInstance.writeError("Unable to print investigation sheet for OrderID=" + orderID + ", store=" + store + ", OrderDate=" + OrderDate.ToString("MM/dd/yyyy") + ".\n\nThe specific error message is:\n\n" + e.Message);
                        return false;
Question by:craigsweet
    LVL 100

    Expert Comment

    What errors do you see other than the LOAD FAILED?

    Is there a report that always seems to fail?

    Do all reports use the same database and the same connection method?


    Author Comment

    I only get "Load Report Failed".

    There is only one report in the application.  This is an order processing application.  My application makes a decision on about 85% of the orders.  Those it cannot decide upon go to Loss Prevention, with a printout, for further investigation.  So, there is only one database (of orders).  Even though the preferences are read via the Preferences class' accessor methods, they don't change.  

    Note:  The application is designed to gracefully handle errors and move on.  I set a flag in the database when a report is printed (the setInvestigationSheetPrinted method above does that, so that when I stop and restart the service I can tell which reports have not printed (i.e. flag is not set but should be).  Since those reports ALWAYS print when I stop and restart the service I know there is nothing wrong with the record in the dabase, the selection formula, etc.  

    I really think this has something to do with either the amount of reports I'm printing but it would be stupid for CR to have a limitation on that.  Note that this has never happened in development since I simply don't print large numbers of reports.  I may print 10 or 15 here or there, but even that's rare.  Even in production it can happen after one day, one week, or one month or longer.  It usually happens every few days currently.  Also, I'm now on a new server.  I was hoping the move from NT to 2003 would solve this but it hasn't.

    This error started when I migrated to Visual Studio 2003 (I'm using VS 2005 now so it's been ongoing for a long time).  

    LVL 7

    Accepted Solution

    I'm guessing that this might be a resource/memory leak issue, try adding this after printing the report:


    Author Comment

    OK, that worked.  That was an amateurish mistake :-)

    I still don't know why the original code, which instantiated the embedded class, didn't work but who cares.  I'll worry about that another day.  I only changed the code to load from disk recently and forgot to close it.  

    I just wrote a test app that loaded the report 100 times in a for loop.  It fails everytime at the 75 th iteration.  When it does fail, it never loads again until you end the program.  Not sure why the garbage collector doesn't help out but, again, who cares at this point.

    Thanks for your help.
    LVL 2

    Expert Comment

    thanks a lot janmarini... After going through numerous web sites and hundreds of useless solutions, this helped me...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
    Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now