Reputation: 25
My WPF project uses Crystal Reports. Everything works in development; the report loads and displays, and nothing is wrong with the DataSet. The following code calls the report:
ReportDocument report = new ReportDocument();
report.Load("../../CrystalReport.rpt");
CustomerLedgerDataSet ds = new CustomerLedgerDataSet();
DataTable dt1 = ds.BillProduct;
DataTable dt2 = ds.Customer;
foreach (var item in customer.CustomerCollection)
{
dt2.Rows.Add(item.Customerid, item.CustomerName, item.CustomerLocation,
item.Customerbalance, item.CustomerLastTally, item.Customerphone);
}
report.SetDataSource(ds);
crystalReportsViewer2.ViewerCore.ReportSource = report;
This works in development but not when deployed on the client's PC. The report viewer shows up but with an empty report. The culprit is this line because it can't work out the path:
report.Load("../../CrystalReport.rpt");
I click once to publish for deployment and installed the same version of Crystal Runtime on the client PC.
Upvotes: 0
Views: 97
Reputation: 4211
Avoid using a lot of folders: try to copy you report in project folder itself. move it out from your report folder like this path
report.Load("~/CrystalReport.rpt")
Upvotes: 1