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