The source of the report definition has not been specified

前端 未结 6 1204
别那么骄傲
别那么骄傲 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:19

    The error is not related to your parameter. The error is related to the ReportPath. See this other SO question regarding setting the report path. Are you sure the relative path you have specified is correct when your application is running. Is that path relative to your source code? If you want to see where it is looking for the file then you can add some code to resolve that relative path (Path.GetFullPath) and see where it is pointing. Make sure your rdlc file is in that folder.

    Edit:
    Based on your updated question and verifying that the report is actually being found. I looked in more detail at your code. You are setting the parameters for the ServerReport, but you are loading the report in the LocalReport. Trying setting the parameters in the LocalReport.

    _reportViewer.LocalReport.SetParameters(report);
    

提交回复
热议问题