异常“报告的定义”无效。通过c#WPF在RDLC报告中使用SetParameters()时

时间:2018-08-03 06:10:00

标签: winforms parameter-passing rdlc report-viewer2010

我的代码在这里。

    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

0 个答案:

没有答案