Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have an asp.net application with crystal reports, i am facing problem when i load report on form this error is getting only for me, when i run my application on my colleague system it is working properly.

my page_load code is


C#
protected void Page_Load(object sender, EventArgs e)
    {
        string strReportPath = "../Report/crt_test.rpt";
        if (!File.Exists(Server.MapPath(strReportPath)))
        {
            Response.Write("Unable to Locate");
        }
        else
        {
            ReportDocument cr;
            cr = new ReportDocument();
            cr.Load(Server.MapPath(strReportPath));
            cr.SetDataSource(dsrpt);
            crv1.ReportSource = cr;
        }
    }


I am getting this error

CSS
Failed to open report.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Failed to open report.




Line 24: ReportDocument cr;
Line 25: cr = new ReportDocument();
Line 26: cr.Load(Server.MapPath(strReportPath));
Line 27: //cr.SetDataSource(dsrpt);
Line 28: crv1.ReportSource = cr;

error in line no. 26

please help me...

thanks in advance
Posted
Updated 29-Nov-13 0:28am
v5
Comments
JoCodes 29-Nov-13 6:11am    
Add the error you are getting in the Question
Ravi Sargam 29-Nov-13 6:21am    
Failed to open report.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Failed to open report.
JoCodes 29-Nov-13 6:22am    
Which line?
Ravi Sargam 29-Nov-13 6:27am    
Line 24: ReportDocument cr;
Line 25: cr = new ReportDocument();
Line 26: cr.Load(Server.MapPath(strReportPath));
Line 27: //cr.SetDataSource(dsrpt);
Line 28: crv1.ReportSource = cr;


line no. 26
JoCodes 29-Nov-13 6:29am    
Have you checked the file exists in the path ../Report/crt_test.rpt and if the folder has the access permission set?

1 solution

 
Share this answer
 
Comments
Member 14660742 23-Jan-20 23:02pm    
This soltion did not worked for me. Please give another solution.

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