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

Server.ScriptTimeout

Status
Not open for further replies.

delpierro

Technical User
Mar 12, 2007
23
NL
If 1 record matches the ID then everthing goes fine
if more than 1 record matches the ID i got Server.ScriptTimeout

Does somebody has any idea why this happens?

dim ID
dim Typering
dim x
dim checkbox(30)

ID = request.Querystring("ID")

Connection.open database
Recordset.open "Select * FROM Types where TypesID=" & ID, connection, 1

while not recordset.EOF
Typering = recordset.fields("Typering")


if Typering <> "" then
x = 0

if right(Typering,1) <> "," then
Typering = Typering & ", #"
end if

array_checkbox = Split(Typering, ", ")

For i = 0 to Ubound(array_checkbox) - 1
Do until Cstr(x) = array_checkbox(i)
x = x + 1

if Cstr(x) = array_checkbox(i) then
checkbox(x) = "checked"
end if

loop
next

end if

recordset.movenext
wend

recordset.close
connection.close
set recordset = nothing
set connection = nothing



 
The problem is an infinite loop that is only entered when the field Typering contains a comma separated list.
 
Sorry, actually the infinate loop occurs when [tt]Cstr(x)[/tt] is not found in [tt]array_checkbox()[/tt]
 
i don't get it.

I copied my code in visualBasic so i can debug it.
Then everthing runs fine i don't get a infinate loop...
 
I found it:
Thank you Sheco! You put me in the right direction!

I deleted:
if right(Typering,1) <> "," then
Typering = Typering & ", #"
end if

and changed:
For i = 0 to Ubound(array_checkbox) - 1
into:
For i = 0 to Ubound(array_checkbox)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top