I have created a Report in the designer and linked it to a table within my database i.e. Select * From and displayed the fields I require.
At runtime I change the dataset depending on user parameters and create a new dataset e.g. Select * From WHERE Wine_Group = 'ENGLAND'
SqlDataAdapter da = new SqlDataAdapter();
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = _exportSQL;
da.SelectCommand = cmd;
DataSet ds = new DataSet();
conn.Open();
da.Fill(ds);
conn.Close();
This new dataset contains my new "truncated" data.
I then render my new report
StiReport rpt = new StiReport();
rpt.Load(Server.MapPath("WinesExport.mrt"));
rpt.RegData(ds);
rpt.Render();
The reports still display the original dataset Select * From ??
Any Ideas?
Many Thanks
Andy
Changing Report Data At Runtime
Changing Report Data At Runtime
Hello,
Please try to use the following code for change query for datasource:
Thank you.
Please try to use the following code for change query for datasource:
Code: Select all
((StiSqlSource)rpt.Dictionary.DataSources["DataSourceName"]).SqlCommand = newSqlCommand;
Changing Report Data At Runtime
Hi Aleksey
Works perfectly :biggrin:
Thanks for your help
Andy
Works perfectly :biggrin:
Thanks for your help
Andy
Changing Report Data At Runtime
Hello,
We are always glad to help you!
Let us know if you need any additional help.
Thank you.
We are always glad to help you!
Let us know if you need any additional help.
Thank you.