Crystal Reports and .Net Caching (aka: Resetting Reports, Invalid Group Number)
Posted on 2004-03-22
I've inherited a project that uses VB.Net (and the CR viewer) to display reports in a web app. The web form is comprised of 3 dropdown list boxes and corresponding labels, 1 button, and the report viewer. The idea is to select a report from the first list box, select parameters from the other list boxes if applicable, and "Generate Report" with the button.
The generated report appears to be cached and on subsequent "Generate Report" calls, the called report does not reset its parameters. Through debugging I've verified that the web form is passing in the correct values to the SetParameterValue call (example below), however using the SQL Profiler, the SPs are not being called with the correct parameters. The "stale" report also causes a secondary issue: some of the reports have drill downs while others do not. If you drill down in one report, then switch to a report without drilldowns, the following error is thrown: "Invalid Group Number". The drilled down group number is still being saved from the previous report.
Some things I attempted:
- Converted the reports to strongly typed reports (added them to project) instead of just passing in the report path to the ReportDocument.Load method in an attempt to not allow caching. [This resulted in no differnece.]
- Changed setting parameter values from index based to name based. Example:
- ReportDocument.SetParameterValue(0, Me.drpDownBox.SelectedValue) ...is now...
- ReportDocument.SetParameterValue("@ParameterOne", Me.drpDownBox.SelectedValue)
- I've tried various reset type methods from multiple objects ... none of which made any difference to the output.
I must be looking for answers in the wrong spot, for this seems to be a simple issue that should be able to be resolved fairly easily. Yet, I have spent at least 24 business hours attempting to find a solution. I've looked over a bunch of sample code, read numerous articles, and rewritten portions of the code multiple times. Any support (even direction pointing) will be greatly appreciated.