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 IfEnd Sub
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 IfEnd 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
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
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.