I am working on rdlc reports, and the reports work just fine. I got stuck when I added one more dataset to the rdlc file. On adding the dataset, it added a data source as well. I ran the project, and the report was no more working giving the error: A data source instance has not been supplied for the data source
Can some one please guide me on what steps to take in order to use multiple datasets. I am using Visual Studio 2012.
4
votes
you have to give add both datset names
- rahularyansharma
possible duplicate of Error While Using Multiple Datasets in RDLC Report
- Habib
nah, i believe its not a duplicate. As Amol (the asker of the question you referred) faced problem when he tried to access the data. I haven't yet tried to access the data. Just adding a dataset caused problem for me.
- Ali Shah Ahmed
2 Answers
9
votes
0
votes
Should be something like this--
ReportViewer.LocalReport.DataSources.Clear();
ReportViewer.LocalReport.DataSources.Add("DataSet_Name",DataTable);
ReportViewer.LocalReport.Refresh();
Important note-- the dataset name has to match the name that appears in the rdlc. To make sure you know what this is, open the rdlc in XML Editor and find out what the name of the dataset is. When you add the datasource programatically you must reference this name as it appears in the rdlc exactly.