Bind report to DataTable
Posted: Tue Oct 18, 2011 1:40 pm
Good afternoon,
In the designer, I am setting a DataSource so that I can get the list of fields that are available in the report.
At runtime however, while I use the same fields, the SQL I use to generate the query can be one of many different combinations.
My question is, how can I use a DataTable as the datasource of the report? The code below is not working (it always returns the results of the DataSource from the designer, as opposed to the DataTable (tbl).
StiReport report = new StiReport();
report.Load("REPORTNAME");
DataTable tbl = ReportDataSource();
report.RegData(tbl);
StiWebViewer1.Report = report;
StiWebViewer1.DataBind();
Thanks!
In the designer, I am setting a DataSource so that I can get the list of fields that are available in the report.
At runtime however, while I use the same fields, the SQL I use to generate the query can be one of many different combinations.
My question is, how can I use a DataTable as the datasource of the report? The code below is not working (it always returns the results of the DataSource from the designer, as opposed to the DataTable (tbl).
StiReport report = new StiReport();
report.Load("REPORTNAME");
DataTable tbl = ReportDataSource();
report.RegData(tbl);
StiWebViewer1.Report = report;
StiWebViewer1.DataBind();
Thanks!