I am currently working for the web based LMS applications which required to generate lots of crystal reports.
My problem is that, it generates the report only fixed number of time (i.e. 75 times Max). After this it display a message 'The maximum report processing jobs limit configured by your system administrator has been reached '
I had tried to find its solution over the internet but unfortunately could not solve the above mention problem. Here is my code which I'm using...
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.Collections;
public partial class Report : System.Web.UI.Page
{
string
name;
private ReportDocument rpt;
private void SetDBLogonForReport(ConnectionInfo
connectionInfo, ReportDocument reportDocument)
{
Tables
tables = reportDocument.Database.Tables;
foreach
(CrystalDecisions.CrystalReports.Engine.Table
table in
tables)
{
TableLogOnInfo
tableLogonInfo = table.LogOnInfo;
tableLogonInfo.ConnectionInfo =
connectionInfo;
table.ApplyLogOnInfo(tableLogonInfo);
}
}
protected void Page_Load(object
sender, EventArgs e)
{
rpt = new
ReportDocument();
name = Session["name"].ToString();
string
reportPath = Server.MapPath("Report.rpt");
rpt.Load(reportPath);
ConnectionInfo
connectionInfo = new ConnectionInfo();
connectionInfo = SqlCon.GetCrystalConnection();
SetDBLogonForReport(connectionInfo, rpt);
CrystalReportViewer1.ReportSource =
rpt;
ParameterFields ParamFields = this.CrystalReportViewer1.ParameterFieldInfo;
ParameterField
login = new ParameterField();
login.Name = "LoginName";
ParameterDiscreteValue
login_Value = new ParameterDiscreteValue();
login_Value.Value = name;
login.CurrentValues.Add(login_Value);
ParamFields.Add(login);
foreach
(TableLogOnInfo cnInfo in
this.CrystalReportViewer1.LogOnInfo)
{
cnInfo.ConnectionInfo =
connectionInfo;
}
this.CrystalReportViewer1.RefreshReport();
}
protected void Page_Unload(object
sender, EventArgs e)
{
CrystalReportViewer1.Dispose();
GC.Collect();
GC.WaitForPendingFinalizers();
}
protected void CrystalReportViewer1_Unload(object sender, EventArgs
e)
{
this.CrystalReportViewer1.ReportSource
= null;
CrystalReportViewer1.Dispose();
if (rpt
!= null)
{
rpt.Close();
rpt.Dispose();
rpt = null;
}
GC.Collect();
GC.WaitForPendingFinalizers();
}
}
Please advice how we can achieve the desired results as soon as possible .
Jinal ShahPosted Jan 11, 2011, 6:54 AM
hello, i m getting same error during call report.
i have to reset PrintJobLimit Automatically using code file. is this Possible?
CATTEAUPosted Mar 12, 2010, 11:23 AM
void Page_Unload(object sender, System.EventArgs e)
{
rpt.Close();
rpt.Dispose();
GC.Collect();
}
Thanks for the registry info
naura paxPosted Dec 11, 2009, 3:38 AM