Invalid Report File Path in C#

Printed From: Crystal Reports Book — Forum Name: Technical Questions

Hi, I am unsure why I am getting this error "Invalid report file path"



Image url: https://www.dropbox.com/s/zudkbb442u73e1j/Invalid%20Report%20File%20Path.JPGdl=0

I am 100% sure that the report is in the correct path, I even tried to put the entire path (e.g. C:\Users\IAmTheUser\Desktop\MyProject\Reports\MyReport.rpt

Here is my code:

ReportDocument rptDoc = new ReportDocument();
        string strRptLoad = Server.MapPath("../Reports/MyReport.rpt");
        rptDoc.Load(strRptLoad);
        //rptDoc.Load("C:\\Users\\IAmTheUser\\Desktop\\MyProject\\Reports\\MyReport.rpt");

        DataSetPrintAll.spSelectReimbursePrintAllDataTable dt = new DataSetPrintAll.spSelectReimbursePrintAllDataTable();
        dtPrintAllAdapter printAdapter = new dtPrintAllAdapter();

        dt = printAdapter.GetData(transactionNo);
        DataSet ds = new DataSet();
        ds.Tables.Add(dt);

        rptDoc.SetDataSource(ds);
        crPrint.ReportSource = rptDoc;
        crPrint.DataBind();
        crPrint.DocumentView = CrystalDecisions.Shared.DocumentViewType.PrintLayout;
        crPrint.Dispose();


Edited by tiamsicb - 03 Nov 2016 at 12:58pm
You have double backslashes setup:

("C:\\Users\\IAmTheUser\\Desktop\\MyProject\\Reports\\MyReport.rpt");

should it not be:

("C:\Users\IAmTheUser\Desktop\MyProject\Reports\MyReport.rpt");

?

Edited by Crystal-Newbie - 03 Nov 2016 at 11:06pm
If I am to use single "/", I should add "@" for it to be read as string and it is the same.