Jun 09, 2014 07:24 AM|circut009|LINK
I have two crystal reports with same ms access database. One crystal report with using table"GenderSample" is working. While the other report using table "Apartment" is not working. I am using two .aspx files to export crystal report into PDF. Both use the
same code but using different datatables.
Bolow code is givng me error that "The Microsoft Jet database engine cannot find the input table or query "Apartment".
Though the table " Apartment" is there in the database.
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = cn;
cmd.CommandText = "select * from Apartment"; // other crystal report uses GenderSample instead of Apartment
OleDbDataAdapter da = new OleDbDataAdapter();
da.SelectCommand = cmd;
DataTable datatable = new DataTable();
da.Fill(datatable); // getting value according to imageID and fill dataset
ReportDocument crystalReport = new ReportDocument(); // creating object of crystal report
crystalReport.Load(Server.MapPath("~/CopyofCrystalReport.rpt")); // path of report
crystalReport.SetDataSource(datatable); // binding datatable
CrystalReportViewer1.ReportSource = crystalReport;
crystalReport.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true, "PersonDetails");
* Note: This error is on the production server on localhost the same thing is working well.
Please let me know what could be the cause. Thanks