简体   繁体   English

由于空白数据源实例,因此无法在VS2013中预览RDLC报告

[英]Not able to preview RDLC report in VS2013 because of blank data source instance

I have been struggling with this issue for two years now. 两年来,我一直在努力解决这个问题。 My problems are happening in Visual Studio 2013 (not a web server). 我的问题发生在Visual Studio 2013(不是Web服务器)中。

Occasionally, I have to take an RDLC file that was created by someone else and make changes to it. 有时,我必须获取由其他人创建的RDLC文件并对其进行更改。 Using VS, I create an XSD file for the dataset, then replace the DataSource and DataSet in the RDLC so that the report now points to the tableadapter(s) in the XSD. 使用VS,我为数据集创建了一个XSD文件,然后替换了RDLC中的DataSource和DataSet,以便报表现在指向XSD中的tableadapter。

Often when I try to view the report in the ReportViewer form, the Report Data Source and Data Source Instance are blank. 通常,当我尝试以ReportViewer表单查看报告时,“报告数据源”和“数据源实例”为空白。 I've tried Rebind Data Sources, and I've cleaned and rebuilt the project, but I can't get the data source to show up. 我已经尝试过重新绑定数据源,并且已经清理并重建了项目,但是无法显示数据源。 Sometimes the report will have a subreport, and that data source will be available if I choose that RDLC. 有时,报告中会有一个子报告,如果我选择该RDLC,则数据源将可用。

I'm a third party developer -- I'm not editing (and cannot edit) aspx files; 我是第三方开发人员-我不编辑(也不能编辑)aspx文件; just the reports. 只是报告。 I've tried editing the code in Form.vb manually to insert the TableAdapter, but it hasn't worked, and I don't really know what I'm doing there -- I have some object-oriented programming experience, but not much. 我已经尝试过手动编辑Form.vb中的代码以插入TableAdapter,但是它没有用,而且我真的不知道自己在那做什么—我有一些面向对象的编程经验,但没有许多。

What can I do to make the data source available to the report viewer and/or bind it to the RDLC? 如何使数据源可用于报表查看器和/或将其绑定到RDLC? Any suggestions are appreciated. 任何建议表示赞赏。 Please let me know if there's any particular code it would be useful to share. 请让我知道是否有任何特定的代码可以共享。

Thank you. 谢谢。

I ended up doing the following, which solved the problem in this case. 我结束了下面的工作,在这种情况下解决了问题。 Not sure it's a solution that will work in all situations like this. 不确定这是否适用于所有情况。

  1. I replaced the opening Report tag in the XML of the RDLC with this: 我将RDLC的XML中的开始Report标记替换为:

<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

  1. I removed the <ReportSections> and <ReportSection> tags, as they are not supported by the 2008 schema. 我删除了<ReportSections><ReportSection>标记,因为2008架构不支持它们。 I didn't remove anything that was between the tags. 我没有删除标签之间的任何内容。

After making these changes, the data source became available to the form, and I was able to preview the report. 进行这些更改之后,数据源可用于表单,并且我能够预览报告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM