Thursday, July 4, 2013

Creating a typed dataset in ReportViewer

CODE SNIPPET

I found this post that shows how to create a typed dataset. Thought I would share it here:

DataTable dt = new DataTable();
DataColumn dc = dt.Columns.Add();
dc.ColumnName = "DataColumn1";
dc = dt.Columns.Add();

dc.ColumnName = "DataColumn2";
dt.Rows.Add(new object[] { "Frank", 32 });
this.reportViewer1.LocalReport.DataSources.Clear();

this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1_DataTable1", dt));
this.reportViewer1.RefreshReport();


Here is the original post

No comments:

Post a Comment

Search This Blog