The techie in me RSS 2.0
 Friday, March 07, 2008

If you are working with Crystal Report and not handling the Report closing properly you must have faced this error.

"The maximum report processing jobs limit configured by your system administrator has been reached."

The error message is self describing; well now the question is how to resolve this issue. The quick answer is making sure that you end the crystal job successfully, i.e. close the report once the user has closed the report. Yes, you have to do this manually.

 

I found multiple methods of doing this from groups, putting down the best methods I found in order.

 

1. Close the report while unloading the report viewer page.

VB.NET code below

Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
    If Not objRpt Is Nothing Then
        objRpt.Close()
        objRpt.Dispose()
    End If
End Sub

This is the best method as far as I can think.

2. The lazy option – change registry key to accept more or infinite numbers

regedit - > navigate to

HKEY_LOCAL_MACHINE/SOftware/Crystal Decisions/Report Application Server/InprocServer/ReportDocument

Change the value of the field MaxNumOfRecords to -1(For Unlimited No. of records)

 

Your sys admin may sue you for changing this J

 

3. I like writing more code, give me an option – ok now for you, the option is create a factory class and when creating class check if the max has reached and clear the old ones. (Not a good idea isn’t it?)

public class ReportFactory
{
    protected static Queue rptQueue = new Queue();

    protected static ReportClass CreateReport(Type reportClass)
    {
        object report = Activator.CreateInstance(reportClass);
        rptQueue.Enqueue(report);
        return (ReportClass)report;
    }

    public static ReportClass GetReport(Type reportClass)
    {
        if (rptQueue.Count > MAX_COUNT) ((ReportClass)rptQueue.Dequeue()).Dispose();
        return CreateReport(reportClass);
    }
}

Choose your own method, as I mentioned my fav is the first one...

 

Good luck

Rujith

 

Friday, March 07, 2008 11:34:17 AM (GMT Standard Time, UTC+00:00)  #    Comments [3] -
Crystal Report
About me
Name : Rujith Anand
Occupation : Eating, drinking, sleeping and Yes ofcourse coding.
Location : Reading, UK
Archive
<March 2010>
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910
Blogs I read
Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Rujith Anand

Statistics
Follow me on Twitter
All Content © 2010, Rujith Anand