我一直在遇到這個問題一個月了,我試了一切來解決它,但沒有反應...(儘量減少數據的負載..),反正此錯誤顯示桌面未重新啓動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