Multiple SQL server access on page load in ASP.NET (VS2005 - .NET 2.0) if using WebViewer on a form

Stimulsoft Reports.NET discussion
Post Reply
Eugene
Posts: 28
Joined: Sat Aug 12, 2006 9:11 am
Location: Ekaterinburg, Russia

Multiple SQL server access on page load in ASP.NET (VS2005 - .NET 2.0) if using WebViewer on a form

Post by Eugene »

Hi, I am developing an ASP.NET application and I use a Web viewer on my form. I have a piece of code which is accessing SQL server database in PageLoad event (inside if (!IsPostBack)), so I want to have only a single query sent to SQL server, which will fill a dataset for the report.

I have found out that it takes a while for the images on the report toolbar (buttons First, Prev, Next, Last, Print, Save) to get displayed which is pretty strange on localhost. My query returns large amounts of data and something made me feel I have multiple accesses to SQL server, cause those buttons appear one after another after certain perios of time (about half a second to a second), again this is on the localhost, so it's along time... I ran Profiler and found out a very wierd thing - I have SEVEN (!!!) exactly the same queries from my application to the database! I tried to hide some of the buttons, finally hiding all of them - and got a remarkable situation - if there are no buttons on the WebViewer toolbar, I have my report displayed and I have one single access to server. The thing is I have the number of page loads equal to one plus number of buttons on the toolbar. All the code is executed multiple times, bringing enormous memory consumption - I have 1 Gb of RAM installed and had my application being terminated several times by the System because of 63% memory consumplion... Divided by seven - about a hundred Mb is normal for my data, so I expect not more than 10%.

So, is there a way to load a page just once, as I intend to have... Seems that the problem is in the component WebViewer - if I remove it from the page or hide all the buttons on the toolbar everything goes fine..

Thank you!
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Multiple SQL server access on page load in ASP.NET (VS2005 - .NET 2.0) if using WebViewer on a form

Post by Vital »

Thanks for your message.

You need add to begin of Page_Load method this line:

C#:

Code: Select all

if (!StiWebViewer1.IsImageRequest)
{
     //Create report
}
Vb.Net:

Code: Select all

If Not Me.StiWebViewer1.IsImageRequest Then
'Create Report

For also you can use property ButtonImages. Specify in this property path to button images.
Archiv with images you can get from ButtonImages.zip

In version 1.61 you don't need use method IsImageRequest. You can request new version at support [at] stimulsoft [dot] com

Thanks.
Post Reply