Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 24, 2012 05:31 AM by sanjay bathre
Oct 22, 2012 11:51 AM|LINK
i want to add the customer list to Report1.rdlc file,
what i did is, i added CustomerList.xsd file and added a DataTable to it
i filled that data table by the code written below,
but the data is not shown to report, please help
DataTable dt = new DataTable();
DataTable dt1 = new DataTable();
ds = cdobj.getCustomerListForDataset();
if (ds.Tables.Rows.Count > 0)
dt1 = ds.Tables;
CustomerList cl = new CustomerList();
//CustomerList cl =
dt = cl.Tables["DataTable1"];
for (int i = 0; i < dt1.Rows.Count; i++)
drow = dt.NewRow();
drow[i] = dt1.Rows[i];
this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("test", cl));
Oct 24, 2012 07:51 PM|LINK
I am not sure, but I feel that you are adding all the rows to datatable dt, but not updating cl.
Finally, you need to update cl, because that is the datasource for the report.
Hope I gave some useful information.
Oct 30, 2012 06:01 AM|LINK
thank you krishna for your reply, but it's not working after updating cl also.......
i also tried like this.....
this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("test", dt));
Oct 30, 2012 11:20 AM|LINK
A couple of things:
1. Is your app a Windows Forms one? Because I see Microsoft.Reporting.WinForms.ReportDataSource which refers to the Report Viewer win forms edition.
2. What is the exact name you set up for the data source in the RDLC report? If it is e.g.
DataSet1 then you must use that name in this line:
this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", cl));
Otherwise reportviewer will not be able to do the binding.
Nov 24, 2012 05:31 AM|LINK
i got the problem, datatable dt is not being filled, thats why no data is shown to report