use recordset.close for adodb.connection?

Posted on 2004-11-01
Last Modified: 2012-06-27
'If I make an object called cn:

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

'Then open the connection: 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
    LVL 7

    Accepted Solution

    LVL 2

    Author Comment

    Thanks a lot, thats some good reading!


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    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…
    This demonstration started out as a follow up to some recently posted questions on the subject of logging in: and…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    934 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

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now