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

 

Related posts:
Friday, March 07, 2008 11:34:17 AM (GMT Standard Time, UTC+00:00)  #    Comments [3] -
Crystal Report
About me
Name : Rujith Anand Send mail to the author(s)
Archive
<March 2008>
SunMonTueWedThuFriSat
2425262728291
2345678
9101112131415
16171819202122
23242526272829
303112345
Blogs I read
Disclaimer

Disclaimer
Postings are provided as is with no warranties, and confer no rights. Opinions expressed here are my own delusions; my employers at best shake their heads and sigh, at worst repudiate the content with extreme prejudice, whenever it manages to appear on their radar.

© Copyright 2012
Rujith Anand

Statistics
Advertisement
All Content © 2012, Rujith Anand