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 Timeout expired problem 1

Status
Not open for further replies.

Elcin

Programmer
Nov 26, 2001
9
SA
Hello,
I am using ASP with a SQL 7.0 database and ADODB connection string. The queries are simple but takes enormous amount of time to retrieve the dataset and most of the time gives a Timeout expired error message.
Using
commandtimeout = 0 'seconds
Server.ScriptTimeOut=240
is also not helping...
The database has around 123468 records.
An example of the query is as follows:
sql = "SELECT .,.,.,.,.,FROM a,b,c where a.SM_DoTM=1 and a.SM_AccNumber=b.SM_AccNumber and a.SM_TMDiag=c.D3_DiagCode and b.SM_Received between '"& Session("SDate")&"' and '"& Session("EDate")&"' and TblSampMain.SM_HospID ="& Session("Hospital")&" and a.SM_TMRndx IN ("&Session("Stat0")&","&Session("Stat1")&","&Session("Stat2")&","&Session("Stat3")&") and b.SM_PatType IN("&Session("Udefine")&","&Session("Screen")&","&Session("Sick")&","&Session("Special")&")" &" order by b.SM_AccNumber"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql_h, conn, 3, 3
If (rs.eof) and (rs.bof) then
response.redirect "error_rpt2.asp"
Else
rs.movefirst

Any suggestions....
 
Hi Elcin,

Your records is really large enough, and if you will display it at one html page clients can't wait that long to load 123,468 records. Why not limit your display to 100 records per page and have a link to proceed to the next page.

Actually m only suggesting 'coz based from experience m not willing to wait for 15 minutes just for the page to load...and even you will extremely increase your ScriptTimeOut still it wont solve that problem 'coz every user have different internet connection and others are still using a dial-up connection for 56kbps.

Regards,
 
Above Idea is good. also why not use stored proc to retrive the data from the database, instead of writing the query in ASP? Write the stored proc and pass arguments to it and get the recordset. Using stored proc will reduce the execution time as they are pre complied statements.

Hope this helps,

srinu...
 
Thank you so much to those who replied, for the information and the tips. I already applied paging and will also write a stored procedure for this.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top