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