Forum Moderators: open

Message Too Old, No Replies

Script Execution Time Out

Script Execution Time Out

         

irshadgurmani

8:05 am on Jul 22, 2007 (gmt 0)

10+ Year Member



Dear i am using following code for generating emails from my site

<%

Response.buffer = True

'Loop until we've hit the EOF (end of file)
Do Until RS.EOF = True

Dim strHTML
strHTML = "<html><head><title>Test Email</title></head>"
strHTML = strHTML & "<body bgcolor=#FFFFFF>"
strHTML = strHTML & "Hi " & RS("Fname") & " " & objRS("Lname") & "<BR><BR>"
strHTML = strHTML & RS("Body")
strHTML = strHTML & "</body></html>"

'Set up the email object
Dim objMail
Set objMail = Server.CreateObject("CDONTS.NewMail")
With objMail
.From = RS("efrom")
.To = RS("Email")
.Subject = RS("Subject")
.BodyFormat = 0 'CdoBodyFormatHTML
.MailFormat = 0 'CdoMailFormatMime
.Body = strHTML
.Send
Response.Write "<BR>Your e-mail to " & RS("Email") & " has been sent. <BR>"

Response.flush

End With
Set objMail = Nothing

RS.MoveNext

EndTime = Now() + (7 / (24 * 60* 60)) '7 seconds
Do While Now() < EndTime
'Do nothing
Loop

Loop

%>

my total records are 50,000 in database

when i execute this code, my system slow down and after NO page display error comes.

I want some code with work with any number of record.

carguy84

8:27 am on Jul 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



well, it seems overly obvious that 50,000 records, times a 7 second wait, is going to timeout any process. That's 350,000 seconds. Why do you have that wait in there?

Also, take out your variable Dims inside the loops and move them up to the top of the page and that the variable cleanup code and move it below loop.

Taking out the wait and moving the declarations will really help.