I am trying to build a report viewer in an ASP.net page. I am using Reportviewer 11.0.0.0 in a VS 2010 project in VS 2012.
I did the following:
- I copied an RDL file from and SSRS report into the project with the extension changed to rdlc.
- I created a datatable in a dataset file using the SQL used in the original SSRS report.
- I opened the report in the report designer and changed the datasource and the dataset to those created in the project in step 2
- After several hours, I was finally able to get the report viewer's smarttag to open and I was able to set the report in the smarttag. The report has the reference to the dataset saved in it. So I guess that is why the "Choose Datasource" box showed up empty. As did the datasource instances.
However, the first run of the report gave me an error reporting:
A data source instance has not been supplied for the data source
So I tried to do it in the page_load by doing the below.
this.rvCodCost.ProcessingMode = ProcessingMode.Local; this.rvCodCost.LocalReport.ReportPath = "Reports/DodIC_Expiration_Report.rdlc"; ReportDataSource rds = new ReportDataSource("ReportDataSet", ReportDataSet.DataTable1DataTable); this.rvCodCost.LocalReport.DataSources.Add(rds);
However this resulted in the error:
The call is ambiguous between the following methods or properties: 'Microsoft.Reporting.WebForms.ReportDataSource.ReportDataSource(string, System.Collections.IEnumerable)' and 'Microsoft.Reporting.WebForms.ReportDataSource.ReportDataSource(string, System.Data.DataTable)'
So I commented out this code and I tried clicking "rebind datasource" several times then running the app. I now got the error,
"The report definition for report 'RptXXX' has not been specified."
It seems like this should be so simple yet I've been working on this one 8 line web page all day and have still not been able to show a report in the report viewer.
I have view a lot of information on the web but most everyone says to fix this issue, put it in the code which throws the error above.
I have not seen anyone address the issue of the empty datasource box in the choose datasource or explain why you set the datasource in the report if it is not used.