Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
While generating PDF file using crystal report its showing as error "invalid report source" My code attached here ..

con.Open();
OracleCommand cmd1 = new OracleCommand("select * from artbmho where status='A'", con);
OracleDataAdapter da = new OracleDataAdapter();
da.SelectCommand = cmd1;
DataTable datatable = new DataTable();
da.Fill(datatable);
ReportDocument crystalReport = new ReportDocument();
crystalReport.Load(Server.MapPath("~/BM.rpt"));
crystalReport.SetDataSource(datatable);

CrystalReportViewer1.ReportSource = crystalReport;

crystalReport.ExportToHttpResponse
(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true, "File");
Posted
Comments
Sinisa Hajnal 1-Oct-15 6:11am    
You have to name the table the same (case sensitive) as the table in the report. If your report data source has the table named "artbmho" then your datatable.Name has to be "artbmho"
aarif moh shaikh 1-Oct-15 6:51am    
agree with Sinisa

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