Click here to Skip to main content
15,917,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

When I put my project in remote site it is showing error and the error is:-
C#
CrystalDecisions.Shared.CrystalReportsException: Load report failed. ---> System.Runtime.InteropServices.COMException: Invalid file name. 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 Crystal_Report_CommonReport.Show_Data

The code which I have written for load the report is :-
C#
ReportDocument boReportDocument = new ReportDocument();
boReportDocument.Load(Server.MapPath("RptCustomerDeposits.rpt"));

Is there any other process to load the report or what the changes I will Do?

Please help me.

Thanks in Advance.
Posted
Updated 8-Dec-11 22:58pm
v2
Comments
sriman.ch 9-Dec-11 5:01am    
Is the report name and path name is correct ? Check that...
JBSAHU 9-Dec-11 5:13am    
yes it is correct.........

 
Share this answer
 
Hi,

See this sample if could help...

C#
private void AddParameter(ReportDocument reportDocument, string value, string parameterName)
    {
        ParameterFieldDefinitions prmDef = reportDocument.DataDefinition.ParameterFields;
        ParameterValues prmVal = new ParameterValues();
        ParameterDiscreteValue prmDiscreteVal = new ParameterDiscreteValue();
        prmDiscreteVal.Value = value;
        prmVal.Add(prmDiscreteVal);
        ParameterFieldDefinition prmFD = prmDef[parameterName];
        try
        {
            prmFD.ApplyCurrentValues(prmVal);
            prmFD.ApplyDefaultValues(prmVal);
        }
        catch (Exception)
        {
            Response.Redirect("~\\Login.aspx");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ReportDocument crpt = new ReportDocument();
        string rptLoc = String.Empty;
        //DataSet1 ds = new DataSet1();  // Had already created a Dataset?

        CrystalReportViewer1.ReportSourceID = "CrystalReportSource1";
        CrystalReportSource1.Report.FileName =
                               Server.MapPath("") + "\\Reports\\RptCustomerDeposits.rpt";
        rptLoc = CrystalReportSource1.Report.FileName;
        crpt.Load(rptLoc);
        crpt.SetDataSource(ds);
        AddParameter(crpt, "12345678", "CardNumber");  // Sample to call AddParameter
        CrystalReportViewer1.ReportSource = crpt;
    }



Regards,
 
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