Hello, all. I am receiving an error that I hope you all can help me with.

After running a while or quite a few reports, I get the message " The
maximum report processing jobs limit configured by your system administrator has been reached."

I know this is because I havent put the following in:

ReportDocumentName.Close();
ReportDocumentName.Dispose();

I have a function that gets data from the DB, and uses a SQLDataAdapter to get the information, then "fills" that to the ReportDocument.

However, when I put that code in right after putting the ReportDocument into another variable and setting the CrystalReportsViewr to the new variable, not the ReportDocument, I get the following error: Object reference not set to an instance of an object.

I thought it might be due to the fact that it was still loading, so I changed the scope of the ReportDocument and moved the

ReportDocumentName.Close();
ReportDocumentName.Dispose();

to the Page_Unload. I am able to run the report, but I get the message "Unable to process your request" in a Message Box. I fI click Show Details, I see the same error as before: "Object reference not set to an instance of the object.


I was hoping to put some sort of code in the Session_End of the Global.asax, but I'm not sure how to even start going about doing this. I've searched and searched, but I can't find anything to help.

I was hoping to find a something that would allow me to find "open" objects of the ReportDocument kind and close them, kind of like a For Each or something similar.

I am new to C#, so perhaps 'm not able to do that. If anyone has any suggestions, I am completely open.

Thank you,

Dani

Recommended Answers

All 11 Replies

Once I had that problem, I believe this piece of code did fix it, because I have never have that problem again, I actually don't like to much using Crystal Reports to many compatability issues, at least that is my experience. anyway I'm using asp.net in this is what i did.

public partial class loadreport : System.Web.UI.Page
{
   ReportDocument rpt = new ReportDocument();
   //In the load function I load my rpt "report" to the CrystalReportViewer
   //Now in my unload method I have this
   protected void Page_UnLoad(object sender, EventArgs e)
   {
      this.CrystalReportViewer1.Dispose();
      this.CrystalReportViewer1 = null;
      rpt.Close();
      rpt.Dispose();
      GC.Collect();
   }
}

Thank you very much for your answer.

Were you still able to scroll through the pages of the report and use the other features like export and print?

Unfortunately, I am not able to. I still get the "Unable to pocess your request" pop up.

So your report shows up? or you get the error first? also try to put a breakpoint in the page unload method just to make sure that piece of code is running when you close your page.

So your report shows up? or you get the error first? also try to put a breakpoint in the page unload method just to make sure that piece of code is running when you close your page.

Thank you for your response. :)

The report shows up if I put the close and dispose in the page_unload event. However, when trying to page through or print or export, I get the error. I have stepped through the code and these (the close and dispose) lines are definitely running. If I comment them out, I don't get the error. But if I comment them out, then the objects aren't disposed of, and I reach the maximum Crystal Reports limit and eventually get the error message for that.

do you have this piece of code in your load event
if(!page.IsPostBack) ? something like that, if you do comment that out and try it.

do you have this piece of code in your load event
if(!page.IsPostBack) ? something like that, if you do comment that out and try it.

I do, but I'm not doing anything about the CrystalReportViewer there, other than hiding the it if it isn't a postback, and filling a dropdown. Removing this from the load event will resolve the issue?

Well I'm not sure but you can give it a try and if that fix that issue then we have a lead.

Well I'm not sure but you can give it a try and if that fix that issue then we have a lead.

Unfortunately, that doesn't seem to work. It just keeps asking for the parameters, even though they are supplied above.

I think it is because the elements are all being reset on the page_load with the (!PostBack) commented out. But I need to fill those there.

Try to move the code that render the report to the Page_Init() method.

Try to move the code that render the report to the Page_Init() method.

I think I already kind of do that:

I have a button on the page [Preview] that calls "BindReport". "BindReport" creates the report based on the options selected by the user in dropdows and text fields, fills the report with information from the database, and then puts that in a Session Variable.

In Page_Init, I check the Session Variable and if it has information, I set the CrystalReportViewer.ReportSource = Session Variable.

In Page_load, I populate the dropdowns so that the user can only select certain options (some of which come from the DB)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.