use recordset.close for adodb.connection?
Posted on 2004-11-01
'If I make an object called cn:
set cn = server.createobject("adodb.connection")
'Then open the connection:
'Then make a recordset object:
set rs = cn.execute("select * from master..syscolumns")
'Then use the rs object
rsArray = rs.getrows
'Then close the rs:
'Then destroy the rs object:
set rs = nothing
'Then close the cn object:
'Then destroy the cn object:
set cn = nothing
My question is: do I have to close the rs object, or do I just have to close the cn object?
When I use the rs.close command it 'logs off' from the SQL server (at least that's what sql profiler says) then 'logs on' when the next rs object is created. When I have a few rs's to create it 'looks' like it runs slow (in sql profiler) because of all the logging on and off, if I don't use the rs.close() command this 'log on/off' crap dosen't occur... as much.
What is this 'log on' 'log off' event in profiler? What should I be doing? Is it wrong to rs.close? Is it wrong not to rs.close?
Thanks for the help