Quantcast
Channel: Visual Studio Report Controls Forum
Viewing all articles
Browse latest Browse all 519

Obtain data source name from .rdlc

$
0
0

I'm using ReportViewer in WPF application.

I need to load the data for the report at runtime, as well setting the ReportPath.

So, I need to provide an instance of ReportDataSource to the LocalReport, but I don't know the DataSourceName that the .rdlc uses. And if I don't the right name, the report give me an error:

"A data source instance has not been supplied for the data source 'DataSet1'"

I don't know that the .rdlc needs "DataSet1". How can I obtain this name from .rdlc?

Here's some code:

var reportDataSource = new ReportDataSource("WHAT TO PASS HERE?");
            reportDataSource.Value = data.Tables[0];

            reportViewer.LocalReport.ReportPath = reportPath;
            reportViewer.LocalReport.DataSources.Add(reportDataSource);
            reportViewer.RefreshReport();


Take a look at WPF FlashMessage


Viewing all articles
Browse latest Browse all 519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>