Author |
Topic |
|
ngaisteve1
Junior Member
Malaysia
241 Posts |
Posted - 26 August 2003 : 23:25:53
|
what do you think of my code below? Is it fine for me to close the connection and recordset object this way or before response.redirect? Or after response.redirect, it will still close them?
if not rs.eof then response.redirect "rate_add_form.asp" else response.redirect "rate_login.asp?errormesg=Invalid user id or password. Try again." end if
conn.close set conn = Nothing rs.close set rs = nothing |
|
jfitz
Junior Member
USA
345 Posts |
Posted - 26 August 2003 : 23:28:53
|
I don't know if it really matters, but I think I would close the record set first, and then close the connection. Theoretically, the recordset is using the connection, and after the connection disappears, you might have a problem closing the record set. Like I said, I don't really know if it makes a difference, but I would always code it that way - in some other environments it probably will make a big difference. |
--Jördan It's a wasted day if you don't spend at least part of it flying upside down. |
|
|
Hamlin
Advanced Member
United Kingdom
2386 Posts |
Posted - 27 August 2003 : 03:23:51
|
I always put it before the redirect, I was under the impression that nothing under the redirect gets executed, as its been redirected to the new page |
|
|
OneWayMule
Dev. Team Member & Support Moderator
Austria
4969 Posts |
|
D3mon
Senior Member
United Kingdom
1685 Posts |
Posted - 27 August 2003 : 04:26:09
|
Why not set the result to a varibale then close the RS and DB connectioin before the if?blnResult = rs.eof
rs.close
set rs = nothing
conn.close
set conn = Nothing
if not blnResult then
response.redirect "rate_add_form.asp"
else
response.redirect "rate_login.asp?errormesg=Invalid user id or password. Try again."
end if |
Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod "In war, the victorious strategist only seeks battle after the victory has been won" |
Edited by - D3mon on 27 August 2003 04:27:16 |
|
|
ngaisteve1
Junior Member
Malaysia
241 Posts |
Posted - 27 August 2003 : 04:37:57
|
ok. Thanks. |
|
|
redbrad0
Advanced Member
USA
3725 Posts |
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 28 August 2003 : 06:49:21
|
The connection should close after a timeout on all versions of IIS afaik, but yes its better to close it explicitly rather than rely on the OS doing it for you. |
Kiwihosting.Net - The Forum Hosting Specialists
|
|
|
|
Topic |
|