我的代码在这里。
private async void GenerateReport()
{
try
{
CatSubcatReportViewer.Reset();
IReportService reportService = new ReportService(new RequestHelper());
APIReportReponse respone = await reportService.GetCatSubcatReportList(Convert.ToInt32(Category.SelectedValue), Convert.ToInt32(Subcategory.SelectedValue), ItemName.Text);
DataTable dt = respone.CatSubcatItemList.ToDataTable();
ReportDataSource ds = new ReportDataSource("CatSubcatItemDataSet", dt);
CatSubcatReportViewer.LocalReport.DataSources.Clear();
CatSubcatReportViewer.LocalReport.DataSources.Add(ds);
CatSubcatReportViewer.LocalReport.ReportEmbeddedResource = "LANRestaurantWPFClient.Reports.CatSubcatItemReport.rdlc";
ReportParameter Param = new ReportParameter("RecordPerPage", RecordPerPage.SelectedValue.ToString(), true);
CatSubcatReportViewer.LocalReport.SetParameters(Param); // in this line exception occur
CatSubcatReportViewer.RefreshReport();
}
catch (Exception ex) { Log.Error(ex.Message + Environment.NewLine + ex.StackTrace); }
}
Microsoft.ReportViewer.Common =>版本10.0.0.0 Microsoft.ReportViewer.Winforms =>版本10.0.0.0