Last post Mar 03, 2012 08:18 AM by asheejtk
Mar 03, 2012 02:39 AM|sheen_buhay|LINK
I am trying to export my crystal report to PDF however it gives me an error "Invalid report file path".
Here's the snippet:
protected void btntest_Click(object sender, EventArgs e)
ReportDocument rptDocmnt = new ReportDocument();
TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = "192.168.0.246";
crConnectionInfo.DatabaseName = "DB_CRITH";
crConnectionInfo.UserID = "sa";
crConnectionInfo.Password = "123456";
CrTables = rptDocmnt.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
string strRptLoad = Server.MapPath("../Reports/PayDetails.rpt");
BinaryReader stream = new BinaryReader(rptDocmnt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat));
Response.ContentType = "application/pdf";
//crvPay.ReportSource = rptDoc;
catch (Exception ex)
The report path is located at "../Reports/PayDetails.rpt" however could not figure it out what went wrong. Please help. Thanks.
Mar 03, 2012 03:06 AM|Mahesh Darkunde|LINK
string strRptLoad = Server.MapPath("..\\Reports\\PayDetails.rpt");
now it can be work..
Mar 03, 2012 03:17 AM|sheen_buhay|LINK
I appreciate your time looking into my concern, I've tried your idea however it's not working as well.
Please help. Thanks.
Mar 03, 2012 05:39 AM|gerrylowry|LINK
sheen, it might help you to help yourself and also your peers here at forums.asp.net to help you if you would walk your code line by line in the debugger* and show us the relevant values that are related to your code snippet ... also, please show
us the full stack trace.
* walking your code with your debugger:
video, c. 8 minutes:
"How Do I: Step with The Debugger in Visual Studio?"
search videos at Google with debug visual studio 2010
Mar 03, 2012 08:18 AM|asheejtk|LINK
It is sure that your path is not correct so let's try with different option.
string strRptLoad = Server.MapPath("~/Reports/PayDetails.rpt");
In above code I assume that report folder directly inside your root folder. If you have some more folder then add that also just before the reports folder.
let me know if doesn't works.