最近在学习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试试。
这篇博客介绍了在使用VS2019和ReportViewer15.0.0.0时遇到的报表创建错误,问题在于报表版本不兼容。解决方案包括删除现有版本,通过NuGet安装ReportViewer12.0,并手动修改.rdlc文件的XML内容,将报告定义的命名空间改为2008版本,删除多余节点。按照这些步骤,可以解决‘An error occurred during local report processing’的问题。
2831

被折叠的 条评论
为什么被折叠?



