Page 1 of 1

Bind report to DataTable

Posted: Tue Oct 18, 2011 1:40 pm
by mobo10
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!

Bind report to DataTable

Posted: Wed Oct 19, 2011 7:56 am
by Vladimir
Hello,

Please try to use this code:
StiReport report = new StiReport();
report.Load("REPORTNAME");

report.Dictionary.Databases.Clear();

DataTable tbl = ReportDataSource();
report.RegData(tbl);
report.Render(false);

StiWebViewer1.Report = report;
Thank you.

Bind report to DataTable

Posted: Sun Oct 23, 2011 9:00 pm
by mobo10
This did not work - all pages come up blank even though the DataTable has rows. I have defined the columns and a datasource in the report designer, I don't know if that matters.

I can include the report mrt if that would help.

Thanks.

Bind report to DataTable

Posted: Mon Oct 24, 2011 5:10 am
by Vladimir
Hello,

Please send us your MRT file, and also data for it, that would reproduce the problem.
You can send your files to support[at]stimulsoft.com with the link to this topic.

Thank you.