Crystal Report查看器问题

时间:2011-01-14 13:10:10

标签: c# asp.net visual-studio-2008 crystal-reports report

我是水晶报道的新手。我在asp.net中使用后端c#创建了One Crystal报表,并在其中添加了图表。当我运行应用程序时,一切正常。它只显示报告viwer栏并给出错误

报告应用程序服务器失败

请帮助我。

先谢谢

1 个答案:

答案 0 :(得分:1)

你的问题没有太多细节。

无论如何,我在MSDN上发现了一篇有趣的帖子:http://social.msdn.microsoft.com/Forums/en/vscrystalreports/thread/a6e12469-2bf1-4c4f-b291-0cf06465b740

那里提供了许多解决方案,因为我们没有您的更多信息,请全部尝试。

  • 临时文件:从临时文件夹中删除临时文件。并重新启动系统。

原因:系统异常关机时发生了这种情况。 Crystal报表在Temp文件夹中有临时报表文件,这些文件没有被删除。由于这个原因导致Load Report失败错误。

  • 注册表:将PrintJobLimit从75更改为-1;

HKEY_LOCAL_MACHINE \ SOFTWARE \ Crystal Decisions \ 10.2 \ Report Application Server \ Server \ PrintJobLimit

  • 以编程方式:

如果你还没有找到解决方案,这是最后一个。这个C#示例非常有效。这里是下面代码的snippit。它突出了人们可以在网上阅读的其他内容中不易察觉的内容。

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);