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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Script Timeout Error 1

Status
Not open for further replies.

Bipasha

Programmer
Feb 28, 2001
23
US
When I try downloading recordsets with 75-100 records - downloads are succesful. Trying to download large recordsets always gives me a script timeout error.

Is there a method to optimize the process (either modigy ADO connection or effective method of looping through recordset, etc..)?? Could anyone suggest a solution please.
 
You could page through the record set. There are different ways of doing this. See:
and

If it actually have to show all the records on one page then you probably will have to raise the script timeout in the IIS.

If you use buffers (default in IIS5) you could use:
response.flush
after some records otherwise the user will have to wait a long time before seing any response from the page.



/J
 
(assuming you are pulling back from SQL Server, and not Access)

also you may want to be careful of the SQL Statement you are executing for example, in one of the very large ActiveX objects we use here, I am debuging the code for performance, I notice, whenever you have a select statement, that ask for fields , then include "From ..." some of the tables are not needed, which in a way sends SQL searching the indexes, and so forth, so cleaning up SQL statements can also help, and also dont worry about complexity of joins and stuff, SQL can handle that fine, just the indexing, and only including what you need that makes it faster.

SQL should be able to handle a couple recordset returns back to the application just fine. (especially if locally)

it may help to show us what kind of connection establishment you are making Karl
kb244@kb244.com
Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)

 
You might want to try using getRows if you just want to view all the records on the screen. It grabs the info from your database and then you can close the connection and still do stuff with the recordset it returns. Of course you can't modify the database using this method, but if you only need to view the info it grabs it fairly quickly. Check out for info about getRows.
And for a canned script that basically does the work for you. Look it over good before you use it, it's really quite nifty.

HTH,
Earme
 
Thank you jonelf, Karl and Earme for all your suggestions.

The following is just to give a clearer picture of my problem:

I have my ADO connection (to SQL DB) in one ASP page - a second ASP page retrieves all the column names of the data I want to display - writes out the column headers, then loops through the recordset (which has already been 'paged') - writes all the data retrieved from DB into a CSV file.

While the ASP page displays all the records (50 records per page) - when all these records (approx. 300 records) get written to a CSV file all at once, the script times out.

Upon testing I found out that most of the time is expended, looping through the recordset. Also I'm pulling only required data (using my 'select' SQL statement - so dont want to make any modifications there).

I havent tried the GetRows method yet. I need to read up matter on it and try it out.

Thanks again, you'll!!

Bipasha
 
getrows is very useful if you do not want to spend your time connected to the SQL Server, what get row does, is puts your recordset into an array numberofrowsxnumberofcolums

so you will have to use VBscript (or javascript) to manage the array.

typically if you know what columns are at which positions
(just an example, not sure which order is what)

for j = LBound(TheArray) to UBound(TheArray)
you might have to use Lbound(TheArray,2) to Ubound(TheArray,2)
response.write TheArray[j][1] (or TheArray[j][Title] if you want to use constants)
.... and so forth Karl
kb244@kb244.com
Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top