Click here to Skip to main content
15,892,269 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I cannot load a report path in windows application. it throws an error Load Report failed. Below is my sample code.

C#
ReportDocument rdoc = new Reportdocument();
string filename = Application.StartupPath +  @"Reports\Report\CrystalReport.rpt";
rdoc.Load(filename);



I tried the filepath as Application.StartupPath, Just given only the report name and
tried
filename = "..\Reports\Report\Crystalreport.rpt"

neither of the solution worked for me..
Kindly advise
Posted

C#
filename = Application.StartupPath.Substring(0,Application.StartupPath.Substring(0,Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\")) + @"\Reports\Report\Crreport.rpt";



Solves the problem
 
Share this answer
 
Problem is not solved.Same error is comes.

Here is my Code:
DataSet dssearch = CRUD.Select("Table", "Field1");
ReportDocument rd1 = new ReportDocument();
string filename = Application.StartupPath.Substring(0, Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\")) + @"\Report\datewiseorder1.rpt";
rd1.Load(filename);
rd1.SetDataSource(dssearch.Tables[0]);

crystalReportViewer1.ReportSource = rd1;
 
Share this answer
 
v2

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