L
Luis
set RS = conn.Execute("SELECT * FROM TblName")
do while not RS.eof
if X = "Blah" then
'do something
RS.close
set RS = nothing
response.redirect "report.asp"
end if
RS.movenext
loop
RS.close
set RS = nothing
conn.close
set conn = nothing
In the above code is it necessary close the RS object and set it to
nothing before the 'response.redirect "report.asp"', or is it ok to
just close everything at the end?
The 'RS.close : set RS = nothing' code is repeated twice so that the
RS object is closed regardless of whether the condition in the If
statement is met. Is there a better way to write this so that the
'RS.close : set RS = nothing' code isn't repeated?
Should I have a response.redirect in the middle of a loop?
If the X condition in the If statement is matched then the redirect is
done while conn is still open. Surely this is "bad" coding?
do while not RS.eof
if X = "Blah" then
'do something
RS.close
set RS = nothing
response.redirect "report.asp"
end if
RS.movenext
loop
RS.close
set RS = nothing
conn.close
set conn = nothing
In the above code is it necessary close the RS object and set it to
nothing before the 'response.redirect "report.asp"', or is it ok to
just close everything at the end?
The 'RS.close : set RS = nothing' code is repeated twice so that the
RS object is closed regardless of whether the condition in the If
statement is met. Is there a better way to write this so that the
'RS.close : set RS = nothing' code isn't repeated?
Should I have a response.redirect in the middle of a loop?
If the X condition in the If statement is matched then the redirect is
done while conn is still open. Surely this is "bad" coding?