Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CrystalReportViewer hitting the database after every page

Status
Not open for further replies.

Varith

Programmer
Jun 16, 2003
18
0
0
US
I'm using CR 10 Developer version, using the .Net CrystalReportViewer object. I have a report that calls an Oracle stored procedure to obtain a fairly small (< 100 rows) dataset. In the RDC refreshing the report only calls the stored proc once. CrystalReportViewer seems to hit the stored proc after every page change. Although the result set is small, the proc does a lot of work and takes 20-30 seconds to run, so running it after every page change is pretty excruciating. Is there any way, short of getting the dataset myself, to keep the viewer from hitting the DB every time? Thanks.
 
I think that if you display the totalpagecount on the first page, it has to work out the entire report prior to displaying the first page.

You may be experiencing some caching as opposed to the SP being hit multiple times, unless you're using a subreport.

-k
 
Thanks SV but that doesn't seem to work. It seems feeding CR datasets or just exporting the whole thing to PDF and viewing it is the best way to go in the long run
 
I have exactly the same problem as you Varith. I had it a while ago with a windows application I was developing with CR for VS.NET. But managed to live with it as the app only had small reports.

I am now working on a larger scale .NET application with CR 10 and its a real problem. Do you think that the problem lies in the CrystalReportViewer web component?
 
Well from what I can tell it adds some parameters to track the some state information (such as web page) and then goes back to the page that has the viewer component every time it switches. So if I just set the report viewer to the datasource it loads up the whole dataset again.
I'm probably just going to export to PDF directly using the ReportDocument object's ExportToHttp method. That'll just generate all of the pages at once and will be fine for the low page count/heavy data crunching reports I have now.
I suppose if I had to have paging, I'd grab the dataset myself and feed it to the ReportDocument object. Then I'd only have to figure out some way to keep the dataset cached on the server between page calls.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top