我正在使用Visual Studio 2012的Microsoft crystal report开发人员版本 . 在我的报告正常工作之前,但是当我在 生产环境 中部署我的报告时,之后我收到错误,系统管理员已经在水晶中配置了最大报告处理作业限制报告,也在内部c-> windows->临时文件夹.rpt文件没有删除 . 如何在临时文件夹中删除它 . 我的代码中有任何错误 . 我正在使用以下代码 . 我怎么能摆脱这个错误 . 我也阅读各种论坛,但我没有找到解决方案
public partial class myClass : System.Web.UI.Page
{
ReportDocument crystalReport = new ReportDocument();
protected void Page_Init(object sender, EventArgs e)
{
crystalReport.Load(Server.MapPath("~/path/mainrep.rpt"));
crystalReport.SetDataSource(dtblstdtmtbl);
int exportFormatFlags = (int)(CrystalDecisions.Shared.ViewerExportFormats.PdfFormat);
cviewer.AllowedExportFormats = exportFormatFlags;
cviewer.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
cviewer.HasToggleGroupTreeButton = false;
cviewer.HasToggleParameterPanelButton = false;
cviewer.DisplayGroupTree = false;
cviewer.EnableDrillDown = false;
cviewer.ReportSource = crystalReport;
}
protected void Page_Unload(object sender, EventArgs e)
{
CloseReports(crystalReport);
crystalReport.Close();
crystalReport.Dispose();
cviewer.Dispose();
crystalReport = null;
cviewer = null;
GC.Collect();
GC.WaitForPendingFinalizers();
}//end page unload
private void CloseReports(ReportDocument reportDocument)
{
Sections sections = reportDocument.ReportDefinition.Sections;
foreach (Section section in sections)
{
ReportObjects reportObjects = section.ReportObjects;
foreach (ReportObject reportObject in reportObjects)
{
if (reportObject.Kind == ReportObjectKind.SubreportObject)
{
SubreportObject subreportObject = (SubreportObject)reportObject;
ReportDocument subReportDocument = subreportObject.OpenSubreport(subreportObject.SubreportName);
subReportDocument.Close();
}
}
}
reportDocument.Close();
}
}