[英]Crystal Reports throwing OutOfMemoryException / Win32Exception (The handle is invalid)
我已经遇到这个问题一个月了,我尝试了所有修复程序,但没有任何反应...(以最小化数据负载。),无论如何,此错误显示了桌面在三天内没有重新启动时,但是重新启动桌面后,该错误不会出现。 请有主见的人帮我谢谢
private void Print(string querySTR, string printerName, bool isShort)
{
ReportDocument cryRpt = new ReportDocument();
DataSet Ds = null;
OracleDataAdapter adapter = null;
try
{
PrintModule prntM = new PrintModule();
OracleConnection conn = new OracleConnection(prntM.conn);
adapter = new OracleDataAdapter(querySTR, conn);
Ds = new DataSet();
adapter.Fill(Ds, "Data");
if (Ds.Tables[0].Rows.Count == 0)
{
throw new Exception("No Batch found to print.");
}
if (isShort)
{
cryRpt.Load("Template4SHORT.rpt");
}
else
{
cryRpt.Load("Template4LONG.rpt");
}
cryRpt.SetDataSource(Ds);
cryRpt.PrintOptions.DissociatePageSizeAndPrinterPaperSize = true;
cryRpt.PrintOptions.PrinterName = printerName;
cryRpt.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
cryRpt.PrintToPrinter(1, false, 1, 1);
}
catch (Exception ex)
{
MessageBox.Show("ERROR IN PRINT FUNCTION " + ex.ToString());
Logger.Error("ERROR IN PRINT FUNCTION " + ex.Message, "PRINTMCONTROLLER");
}
finally
{
Ds.Dispose();
cryRpt.Dispose();
GC.SuppressFinalize(this);
}
}
它的打印机问题不包括Crystal报告,请尝试安装适当的驱动程序并设置默认打印机,调试代码,然后在调用Print(...)方法时检查其选择的名称是否正确。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.