We have an MDI application that when a used wants to run a report, we first display a filter form that we created that will allow the user to select the filter criteria. Once the user selects the filter criteria, the user then clicks a button that will generate the report and display it in the viewer. The way we pass the filter criteria to the report is to change the SQL that the report uses. The problem that I am running into is that the report that is displayed the first time shows the report just fine. If I then close the viewer and alter the filter then rerun the viewer, the report that is generated is identical to the first time it is created.
Here is a block of code that duplicates the problem:
Code: Select all
Stimulsoft.Report.Dictionary.StiSqlSource tableSource = _report.DataSources["ds_WorkOrders"] as Stimulsoft.Report.Dictionary.StiSqlSource;
tableSource.SqlCommand = "SELECT * FROM WorkOrders WHERE UID = 4";
_report.Compile();
_report.Render(true);
_report.Show();
tableSource.SqlCommand = "SELECT * FROM WorkOrders WHERE UID = 5";
_report.Compile();
_report.Render(true);
_report.Show();
I am guessing that I am missing some code that would display the reports correctly. How do I get this so that the first report would display record UID 4 and the second report would display the record UID 5?