Hello guys,
I'm working with c# windows application (wpf - not web application).
Application is developed in Visual Studio 2010.
Main purpose of my application is to print something, and I'm using crystal reports to do that.
But when I print one document after another I started facing issue:
Load report failed. COMException (0x80000000). The maximum report processing jobs limit configured by your system administrator has been reached.
I realized that is happening after 75 printed documents, so I chaged PrintJobLimit in registry of my computer from 75 to higher number, but that did not help me also, and I think that is not good solution!
I researched a lot but I could not fix this, this is my code and this is my edited function in a hope I might fix it, but unfortunately I did not :( :(
MY METHOD WHICH IS USED TO PRINT DOUCUMENT:
public static void PrintReportDocument_WithUsing(User _userId, DataSetReports ds) { string FilePath = AppDomain.CurrentDomain.BaseDirectory; //Path where I'm keeping my reports, ussualy it's in ProjectName\bin\Debug folder.. using (ReportDocument rpt_documentOne = new rpt_MyReport()) { rpt_documentOne.FileName = path + "rpt_MyReport.rpt"; ((TextObject)((rpt_MyReport)rpt_documentOne).Section4.ReportObjects["txtThanks"]).Text = Util.ThankYouMessage; ((TextObject)((rpt_MyReport)rpt_documentOne).Section4.ReportObjects["txtMessage"]).Text = Util.Info; ((TextObject)((rpt_MyReport)rpt_documentOne).Section4.ReportObjects["txtWirelessKEY"]).Text = Util.WirelessKEY; ((TextObject)((rpt_MyReport)rpt_documentOne).Section4.ReportObjects["txtWirelessSSID"]).Text = Util.WirelessURL; if (_userId != null) ((TextObject)((rpt_MyReport)rpt_documentOne).Section4.ReportObjects["MessageUser"]).Text = "VIP user: " + _userId.Name + ";+ "Discount: " + _userId.Percent.ToString() + "%"; rpt_documentOne.SetDataSource(ds); PrintReportDocument_C(rpt_documentOne); // I added this also, even if my document is created into using statement.. rpt_documentOne.Close(); rpt_documentOne.Clone(); rpt_documentOne.Dispose(); GC.Collect(); GC.WaitForPendingFinalizers(); } }
So guys if anyone know how could I solve this I would appreciate that so much!
Maybee you should remove the "rpt_documentOne.Clone();"
Hi Eldin,
That is odd, why are you cloning the report and then closing it. I've never seen anyone do that before.
Problem is the WPF viewer will not let you close the report without replacing it with another one.
I've never tested opening 75 jobs with the WPF app., when I get time I'll try it.
Using a Windows Form is much more robust and tested so you may want to convert to it.
Don