use recordset.close for adodb.connection?

'If I make an object called cn:

set cn = server.createobject("adodb.connection")

'Then open the connection:

cn.open dsnStr

'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:

rs.close

'Then destroy the rs object:

set rs = nothing

'Then close the cn object:

cn.close

'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

-Coolhand2120
LVL 2
Coolhand2120Asked:
Who is Participating?
 
Coolhand2120Author Commented:
Thanks a lot, thats some good reading!

-Coolhand2120
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.