Scenario:
I have a report. When it is run it only displays records with a boolean flag != 1. After it runs, it needs to flip the flag to 1 so it won't show again.
Attempted solutions:
Request:
So my question would be simply is there any way in the report obj or in the typed dataset it pulls from, to cache the data and make sure the results in the preview/print window match the initial html preview? If not, is there a way to make it not render the html preview at all and instead have the first request for data be the print dialog?
I have a report. When it is run it only displays records with a boolean flag != 1. After it runs, it needs to flip the flag to 1 so it won't show again.
Attempted solutions:
- Make the report window modal, and when it is closed, update the database setting the flag to 1 for all records in the report. This worked perfectly except users on terminal services would leave the report open, get timed out, records don't get updated, they have to reopen/reprint the report to fix it.
- Make the VB form that contains the report set the flags in the OnPreRender, this happens too soon and the data is not there when the report is displayed. Tried OnPreRenderComplete as well. Also tried the reportviewer object's prerender... all of these happened too early.
- Add the updating code to the select query, so that we get the records we need and THEN immediately update the boolean flag. This I feel is the proper solution unless there is a better one I've not thought of yet; however when the print dialog is displayed, evidently it makes another trip to the database and runs the stored proc again... therefore the printed report is blank. I feel this is either just the default behavior or it's because I'm using the NeedsDataSource event to run the storedproc/fill the data set.
Request:
So my question would be simply is there any way in the report obj or in the typed dataset it pulls from, to cache the data and make sure the results in the preview/print window match the initial html preview? If not, is there a way to make it not render the html preview at all and instead have the first request for data be the print dialog?