Crystal Report在部署后无法加载错误

问题描述:

我在Visual Studio 2008中使用.NET framework 3.5开发了一个应用程序。

我在其中一种形式中使用了水晶报告。数据动态绑定到报表。当我从Visual Studio运行应用程序时,一切正常。但是,使用Innosetup创建设置并运行应用程序后,报表无法正确加载。它只是给出以下错误



Hi, I've an application developed in .NET framework 3.5 in Visual studio 2008.
I've used a crystal report in one of the forms in it. The data is bound to the report dynamically. Everything works correctly when I run the application from Visual studio. However, after a setup is created using Innosetup and the application is run, the report doesn't load correctly. It just gives the following error

Exception: Load report failed.

Inner Exception: System.Runtime.InteropServices.COMException (0x80004005): Access is denied.

   at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)

   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)

   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()





加载报告的代码如下:





The code for loading the report is as follows:

DataSetBillDetails details = new DataSetBillDetails();
                DataTable billDetailsDataTable = GetBillDetailsDataTable();
                details.Tables["FeeBillTable"].Merge(billDetailsDataTable);
                ReportDocument document = new ReportDocument();
                //document.Load("../../FeeBillReport.rpt");
                string strStartupPath = Application.StartupPath;
                string strReportPath = strStartupPath.Replace(@"bin\Release", "FeeBillReport.rpt");
                document.Load(strReportPath);
                document.SetDataSource((DataSet)details);
                document.DataDefinition.FormulaFields["FeeItems"].Text = "'" + billDetailsDataTable.Rows[0]["FeeItems"].ToString().Replace("\r\n", "' + chr(10) + '") + "'";
                document.DataDefinition.FormulaFields["FeeAmounts"].Text = "'" + billDetailsDataTable.Rows[0]["FeeAmounts"].ToString().Replace("\r\n", "' + chr(10) + '") + "'";
                crystalReportViewerBill.ReportSource = document;





有什么办法可以解决这个错误吗?



Is there any way to deal with this error?