Ram Ram - 10 months ago 82
C# Question

Load report failed in Crystal Report

I am trying to export crystal report into pdf in Windows Form application.My Crystal Report is getting data from the Mysql Database.Here is my code for the same..

ReportDocument doc = new ReportDocument();

SaveFileDialog saveas = new SaveFileDialog();
saveas.Filter = "*.pdf|(PDF File)";
if (saveas.ShowDialog() == DialogResult.OK)

doc.ExportToDisk(ExportFormatType.PortableDocFormat, saveas.FileName + ".pdf");
MessageBox.Show("Report Exported !");


On running the above code. I am getting error

'Load report failed' at line

Please help me resolve this.

Answer Source

I think the error seems to be the path of your report.

Let's try this:

doc.Load(AppDomain.CurrentDomain.BaseDirectory + "CrystalReport1.rpt");