Quantcast
Channel: SQL Server Reporting Services
Viewing all articles
Browse latest Browse all 1418

Dynamic Report Viewer - A data source instance has not been supplied for the data source

$
0
0

I am sure my problem is simply a misunderstanding of how this should work, but here is what I am trying to do.

I created a folder in my project called /Reports.  Inside this folder, I am creating about 25 different report files (*.rdlc files), and each one of these .rdlc files has a datasource attached to it.  Next, I created a .aspx page with a dropdown and the user selects the report they want to view.  On the code-behind, I simply check for the value of the selected item, and call out to the report I want to display:

ReportViewer1.LocalReport.ReportPath = Server.MapPath("/Reports/referenceTableAdviceCode.rdlc");

My assumption was this is all that is needed, as the actual report (referenceTableAdviceCode.rdlc) has the datasource assigned to it, as I created the report (headers and data) based on the datasource.

However:  when I go to my .aspx page and select the report, I keep getting the following error:  '

  • A data source instance has not been supplied for the data source 'ReferenceTableAdviceCodes'.
 

If I try to create a new DataSource:

     report.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("ReferenceTableAdviceCodes"));

  • I get the following error:  "An error has occurred during report processing.
  • Cannot create a data reader for dataset 'ReferenceTableAdviceCodes'."

I am not sure how to get a different report to show depending upon the selection of the dropdown. 

 


Viewing all articles
Browse latest Browse all 1418

Trending Articles