DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Mar 2004
    Posts
    102

    closing recordset after closing connection

    hi there....

    my friend believes that no matter if you write this code::

    cn.close
    set cn = nothing

    rs.close
    set rs = nothing

    but I believe that it's not logical....what do you mean?
    Sonia

  2. #2
    Join Date
    Oct 2005
    Posts
    2

    Exclamation Object Close

    Hi,
    if recordset/Connection is open, it will get closed and destroyed, and if it is already closed, then it will just get destroyed.

    so better to destroy the objects while closing...

    --
    Venkat

  3. #3
    Join Date
    Mar 2004
    Posts
    102
    no I mean the sequence order of closing them.....do you agree with it? First closing connection the closing recordset?
    Sonia

  4. #4
    Join Date
    Oct 2005
    Posts
    2
    Using the Close method to close a Connection object also closes any active Recordset objects associated with the connection. A Command object associated with the Connection object you are closing will persist, but it will no longer be associated with a Connection object...
    (ie.,) its ActiveConnection property will be set to Nothing....

    So
    cn.close
    set cn = nothing
    will close rs and no point in closing the RS.

Similar Threads

  1. VB doesn't wait until SQL-query has finished
    By Daniel Teufert in forum VB Classic
    Replies: 2
    Last Post: 04-24-2002, 02:34 PM
  2. Requerying a reshaped recordset
    By Jonathan Gibbs in forum VB Classic
    Replies: 0
    Last Post: 08-09-2001, 02:34 PM
  3. recordset and connection question...
    By Sok in forum VB Classic
    Replies: 2
    Last Post: 02-09-2001, 12:28 PM
  4. Replies: 1
    Last Post: 10-24-2000, 04:48 PM
  5. AddNew in a recordset using a DSN-Less connection
    By Justin Orton in forum ASP.NET
    Replies: 0
    Last Post: 04-30-2000, 08:34 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links