Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Invalid Report File Path in C# Post Reply Post New Topic
Author Message
tiamsicb
Newbie
Newbie
Avatar

Joined: 01 Nov 2016
Location: Philippines
Online Status: Offline
Posts: 2
Quote tiamsicb Replybullet Topic: Invalid Report File Path in C#
    Posted: 03 Nov 2016 at 12:56pm
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
Every start is hard for us but as time pass, everything will be a piece of cake
IP IP Logged
Crystal-Newbie
Newbie
Newbie


Joined: 02 Nov 2016
Online Status: Offline
Posts: 6
Quote Crystal-Newbie Replybullet Posted: 03 Nov 2016 at 11:05pm
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
IP IP Logged
tiamsicb
Newbie
Newbie
Avatar

Joined: 01 Nov 2016
Location: Philippines
Online Status: Offline
Posts: 2
Quote tiamsicb Replybullet Posted: 06 Nov 2016 at 12:01pm
If I am to use single "/", I should add "@" for it to be read as string and it is the same.
Every start is hard for us but as time pass, everything will be a piece of cake
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.