C# .NET - load report failed in crystal Report

Asked By selva kumar on 20-Jul-10 08:21 AM

hi hi tried to export crystal report into pdf file. but when i am running i am getting error load report failed

And my code is in .cs is

ReportDocument cryRpt = new ReportDocument();

cryRpt.Load("c:\\CrystalReport.pdf");

crystalReportViewer1.ReportSource = cryRpt;

crystalReportViewer1.Refresh();

Anand Malli replied to selva kumar on 20-Jul-10 08:48 AM

Hi Selva


In ReportViewer there has to be .rpt file should be loaded,you are loading .pdf file in ReportDocument,so just make sure you are doing it right,load the .rpt file for report


let me know

thxs

selva kumar replied to Anand Malli on 20-Jul-10 08:58 AM

Yes Anand i have rpt file named crystalreport.prt. I have gone through several asp forum . But i could not find a solution . It would be helpful if you fix the problem.





Thanks & Regards

K.Selva

Anand Malli replied to selva kumar on 20-Jul-10 09:14 AM

Hi Selva


Have you tried giving other data source to your report,just try below code and we will make changes as per you requirement


ReportDocument cryRpt= new ReportDocument();
  
cryRpt.Load("c:\\CrystalReport.rpt");
  
DataTable dt=new DataTable();//Fiil with some data- Or try binding blank data
  
cryRpt.Database.Tables[0].SetDataSource(dt);
  
crystalReportViewer1.ReportSource = cryRpt;

let me know

thxs