p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: Re: How to use ScriptTimeout in Loops ?


Message #1 by "Ken Schaefer" <ken@a...> on Mon, 4 Mar 2002 16:23:21 +1100
Personally I don't think using ASP files is the best way to go about doing
this type of work. You're better off writing yourself a VB app, or a little
vbs script instead.

That said, what you could do is something like this. Have the page accept a
parameter sent via the querystring which tells it which record it was up to
in the database, so you'd start with:

DoStuff.asp?ID = 1

DoStuff processes the first 100 records. If there are more records it then
issues a Response.Redirect:

<%
intNextRecord = "101"
If blnMoreRecords
    Response.Redirect("DoStuff.asp?ID=" & intNextRecord)
Else
    Response.Write("All Done")
End If
%>

and so on until all the records are processed, in which case it writes out
"all done". This way you can set the Server.ScriptTimeout to a smaller value
since each "page" is doing less work.

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Michael Bischof" <m.bischof@c...>
Subject: [proasp_codeclinic] How to use ScriptTimeout in Loops ?


: maybe someone of you can help me:
: I want to start a mail sending process and want to reset the
: Server.ScriptTimeout every time the loop starts to the value of 120
: seconds.
: i tried this way:
:
: WHILE NOT rs.EOF
: Server.ScriptTimeout = 120
: 'code....
:
: WEND
:
: but it dont work.
: I dont want to set the default Timeout the several hours, because the
: script may hang up or something like that and then i can't access the
: script and database until this very big timeout has expired... :-(
:
: What can i do?
: ( Must i reload the page to reset the ScriptTimeout value? )

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  Return to Index