The source of the report definition has not been specified

前端 未结 6 1190
别那么骄傲
别那么骄傲 2020-12-21 12:41

I\'m using the following code trying to SetParametr :

    var report = new ReportParameter[1];
    report[0] = new ReportParameter(\"MyName\", \"Raha\");
            


        
6条回答
  •  醉梦人生
    2020-12-21 13:31

    I found myself stuck with the same error, and the reason is actually quite simple: the Report Definition must be set in the first place, before the parameters. This way, the LocalReport can check if they are really mandatory and eventually throw an exception.

    The code below should work:

    _reportViewer.LocalReport.DataSources.Add(reportDataSource1);
    _reportViewer.LocalReport.ReportPath = "../../Report1.rdlc";
    _reportViewer.ServerReport.SetParameters(report);
    

提交回复
热议问题