Changing Report Data At Runtime
Posted: Mon Mar 26, 2012 10:32 am
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
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