I'm getting “The report definition for report 'xxxx.rdlc' has not been specified” in my RDLC report

前端 未结 6 1803
野的像风
野的像风 2020-12-02 02:23

I\'ve created an rdlc report. I have a reportViewer on my form. When I try to load the report I get : \"The report definition for report \'xxxx.rdlc\' has not been specifie

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-02 03:00

    There are some reasons causing this problem and sometimes the problem might occur only when publishing the same application to IIS. If the report file (*.rdlc) is existed in the related location and the problem still continues, you can try the following methods in order to fix it:

    from LocalReport.ReportEmbeddedResource Property on MSDN
    “… An embedded report resource is a report definition that has been stored as a resource in the calling assembly. If the ReportPath property has been set, the ReportEmbeddedResource property is ignored. It also causes the report loaded with LoadReportDefinition to be ignored.”

    Change:

    reportViewer.LocalReport.ReportPath = Server.MapPath("~/Reporting/YourReportName.rdlc");
    

    to:

    rw.LocalReport.ReportEmbeddedResource = "YourFullNamespace.Reporting.YourReportName.rdlc";
    

    And then change Build Action property to Embedded Resource from the properties of YourReportName.rdlc file. Hope this helps...


提交回复
热议问题