use recordset.close for adodb.connection?

Posted on 2004-11-01
Medium Priority
Last Modified: 2012-06-27
'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:


'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

Question by:Coolhand2120

Accepted Solution

suramsureshbabu earned 2000 total points
ID: 12469353

Author Comment

ID: 12469554
Thanks a lot, thats some good reading!


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question