Click here to Skip to main content
15,851,387 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
My code here ;

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)); //In Here Error

           m_rptDoc.SetDataSource(ds);

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

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



Okay, thanks before.I have problem when load report. I check the path of report is right and check permission for report is allow access.
Now, i have problem : when i use administrator to access that's report it's work, but when i access use user not administrator any error "Load Report Failed". I see permission for user is allow to access folder report. Someone knows and want to help me, why it's not work for user not administrator?

Urgent.
Thank you
Posted

1 solution

 
Share this answer
 

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