1
Answer

Use Datatable for report viewer programatically

Hello,


I need to pass datatable to report viewer for reporting purpose programmatically ,but i am not able to fetch data inside the datatable

my code is this .

           dt.TableName = "datatable1";
                ReportDataSource odata = new ReportDataSource("DataTable1", dt);
                odata.Name = "testc";
               odata.Value = ds.Tables["dt"];
             //  ReportViewer1.LocalReport.DataSources("datatable1",dt);
                ReportViewer1.LocalReport.DataSources.Add(odata);
                ReportViewer1.DataBind();


             //  ReportDataSource source = new ReportDataSource("DataTable1", dt);
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(odata);
                ReportViewer1.DataBind();
               ReportViewer1.LocalReport.Refresh();
Answers (1)