简体   繁体   中英

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).

Occasionally, I have to take an RDLC file that was created by someone else and make changes to it. 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.

Often when I try to view the report in the ReportViewer form, the Report Data Source and Data Source Instance are blank. 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.

I'm a third party developer -- I'm not editing (and cannot edit) aspx files; 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.

What can I do to make the data source available to the report viewer and/or bind it to the 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:

<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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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