【发布时间】:2011-05-07 19:20:31
【问题描述】:
我是 Crystal Report 的新手。我用后端 c# 在 asp.net 中创建了一个 Crystal 报表,并在其中添加了图表。一切都正常,但是当我运行应用程序时。它只显示报告查看器栏并给出错误,即
报表应用服务器失败
请帮帮我。
提前致谢
【问题讨论】:
标签: c# asp.net visual-studio-2008 crystal-reports report
我是 Crystal Report 的新手。我用后端 c# 在 asp.net 中创建了一个 Crystal 报表,并在其中添加了图表。一切都正常,但是当我运行应用程序时。它只显示报告查看器栏并给出错误,即
报表应用服务器失败
请帮帮我。
提前致谢
【问题讨论】:
标签: c# asp.net visual-studio-2008 crystal-reports report
你的问题没有太多细节。
我在 MSDN 上发现了一个有趣的帖子:http://social.msdn.microsoft.com/Forums/en/vscrystalreports/thread/a6e12469-2bf1-4c4f-b291-0cf06465b740。
那里提供了许多解决方案,因为我们没有您提供的更多信息,请全部尝试。
原因:系统异常关机时发生。 Crystal 报表在 Temp 文件夹中有临时报表文件,这些文件没有被淘汰。因此,它导致了 Load Report failed 错误。
HKEY_LOCAL_MACHINE\SOFTWARE\Crystal Decisions\10.2\Report Application Server\Server\PrintJobLimit
如果您还没有找到解决方案,这里是最后一个。这个 C# 示例完美运行。这是下面的代码片段。它突出了人们在网络上可以阅读的任何其他内容中不容易看到的内容。
private ReportDocument CrystalRpt;
//Declaring these here and disposing in the Page_Unload event was the key. Then the only other issue was the
// limitations of Crystal 11 and simultaneous access to the rpt file. I make a temp copy of the file and use that in the
// method. Then I delete the temp file in the unload event.
private ReportDocument mySubRepDoc;
private ReportClass ReportObject;
private string tmpReportName;
protected void Page_UnLoad(object sender, EventArgs e)
{
Try
{
CrystalReportViewer1.Dispose();
CrystalReportViewer1 = null;
CrystalRpt.Close();
CrystalRpt.Dispose();
CrystalRpt = null;
mySubRepDoc.Close();
mySubRepDoc.Dispose();
mySubRepDoc = null;
ReportObject.Close();
ReportObject.Dispose();
ReportObject = null;
GC.Collect();
File.Delete(tmpReportName);
}
catch
{ ...Error Handler }
}
protected void Page_Load(object sender, EventArgs e)
{
CrystalRpt = new ReportDocument();
ConnectionInfo CrystalConn = new ConnectionInfo();
TableLogOnInfo tblLogonInfo = new TableLogOnInfo();
ReportObject = new ReportClass();
TableLogOnInfo CrystalLogonInfo = new TableLogOnInfo();
ParameterField CrystalParameter = new ParameterField();
ParameterFields CrystalParameters = new ParameterFields();
ParameterDiscreteValue CrystalParameterDV = new ParameterDiscreteValue();
TableLogOnInfo ConInfo = new TableLogOnInfo();
SubreportObject mySubReportObject;
mySubRepDoc = new ReportDocument();
//Report name is sent in querystring.
string ReportName = Request.QueryString["ReportName"];
// I did this because Crystal 11 only supports 3 simultaneous users accessing the report and
// we have up to 60 at any time. This copies the actual rpt file to a temp rpt file. The temp rpt
// file is used and then is deleted in the Page_Unload event
Random MyRandomNumber = new Random();
tmpReportName = ReportName.Replace(".rpt", "").Replace(".ltr", "") + MyRandomNumber.Next().ToString() +".rpt";
File.Copy(ReportName, tmpReportName, true);
CrystalRpt.Load(tmpReportName);
【讨论】: