最近在学习ReportViewer控件创建.rdlc报表。遇到了“无法创建报表....ReportView.WebForm 15.0.0.0”的错误。开发环境:vs2019,报表版本:15.0.0.0。需要删除掉15.0.0.0,在nuget中安装reportviewer12.0版本。.aspx的"查看设计器"页面的报错接触。后来在ctrl+F5运行时,又出现了新问题:“
- An error occurred during local report processing.
- The definition of the report 'F:\03练习\ReportsWebsite1\ReportsWebsite1\Report2.rdlc' is invalid.
- The definition of this report is not valid or supported by this version of Reporting Services. The report definition may have been created with a later version of Reporting Services, or contain content that is not well-formed or not valid based on Reporting Services schemas. Details: The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition' which cannot be upgraded.
- The definition of the report 'F:\03练习\ReportsWebsite1\ReportsWebsite1\Report2.rdlc' is invalid.
”
这是由于在修改报表文件后,系统自动保存.rdlc文件时,修改了版本相关信息。需要做如下三点修改:
先打开.rdlc文件,操作方法:右键点击.rdlc文件,选择"xml(文本)编辑"。
修改1.将开头的“<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
”修改为:“<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
”
修改2:
删除节点描述的这两行:
<ReportSections>
<ReportSection>
和对应的结束节点两行:
</ReportSection>
</ReportSections>
修改3:
删除节点: <ReportParametersLayout>
<ReportParametersLayout>
....(这两行之间的内容也全部删除哈)
</ReportParametersLayout>
保存,重新执行ctrl+F5试试。