我一直在遇到这个问题一个月了,我试了一切来解决它,但没有反应...(尽量减少数据的负载..),反正此错误显示桌面未重新启动3天,但如果重新启动桌面,则不会显示该错误。请人以极大的心灵帮我感谢水晶报告抛出OutOfMemoryException/Win32Exception(该句柄无效)
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);
}
}
你是否在另一个桌面上试过这个,看看错误是否存在。 – vcs
是的,我在2台桌面上部署了它们,它们都出现此错误。 – porknbeans
@vcs嗯..有没有一种方法来衡量或识别我制作的应用程序是否能够在体面的内置桌面上运行?我是软件开发新手。 – porknbeans