Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
My Code
C#
private void p_PreviewReport()
      {
          m_rptDoc = new ReportDocument();
          dsCAPEX_Report ds = new dsCAPEX_Report();
          string szRptPath = string.Empty;


              switch (ddlReport.SelectedIndex)
              {
                  case 0:
                      m_dt = m_objCAPEXReport.GetCAPEX_DetailProject
                          (txtProjectCode.Text, ddlPeriodYear.SelectedValue, ddlLocationCode.SelectedValue);
                      szRptPath = "/Report/crCAPEX_DetailProject.rpt";
                      m_dt.TableName = "dtCAPEX_DetailProject";
                      break;
                  case 1:
                      m_dt = m_objCAPEXReport.GetCAPEX_SummaryActivity
                          (txtProjectCode.Text, ddlPeriodYear.SelectedValue, ddlLocationCode.SelectedValue);
                      szRptPath = "/Report/crCAPEX_SummaryActivity.rpt";
                      m_dt.TableName = "dtCAPEX_SummaryActivity";
                      break;
                  case 2:
                      m_dt = m_objCAPEXReport.GetCAPEX_SummaryActivityPC
                          (txtProjectCode.Text, ddlPeriodYear.SelectedValue, ddlLocationCode.SelectedValue);
                      szRptPath = "/Report/crCAPEX_SummaryActivityPC.rpt";
                      m_dt.TableName = "dtCAPEX_SummaryActivityPC";
                      break;
              }

              ds.Tables[m_dt.TableName].Merge(m_dt);
              m_rptDoc.Load(Server.MapPath(szRptPath)); //Error

              m_rptDoc.SetDataSource(ds);

              CrystalReportViewer1.ReportSource = m_rptDoc;
              CrystalReportViewer1.DataBind();

              m_rptDoc.SetParameterValue("szPeriodYear", ddlPeriodYear.SelectedValue);
              m_rptDoc.SetParameterValue("szLocation", ddlLocationCode.SelectedItem.Text);

              m_rptDoc.Close();

      }



I get Error
CrystalDecisions.Shared.CrystalReportsException: Load report failed. ---> 
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() 
--- End of inner exception stack trace ---
 at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() 
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) at 
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename) at CustomWebPart_1.VwpReportCAPEX.VwpReportCAPEXUserControl.p_PreviewReport() 
at CustomWebPart_1.VwpReportCAPEX.VwpReportCAPEXUserControl.btnExport_OnClick(Object sender, EventArgs e) 


Urgent.
Please help me to solve my problem.
I give permission full control to report folder and c:windows/temp
And i check path report, it's right nothing problem with path. But i still get error like that.
Help me.
Posted
Updated 29-Jun-15 23:03pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900