Results 1 to 4 of 4

Thread: ADO - rs.Close or set rs=nothing

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539

    Talking

    ADO - rs.Close or set rs=nothing

    which one is better?

    if i set RS = Nothing do i have to
    put
    Code:
     Set RS = New ADODB.Recordset
    before i can use this record again?

    thanks


  2. #2
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565
    I always use both when closing ...

    Code:
    rs.Close
    set rs = Nothing
    I also always "set rs = new adodb.recordset" when re-using a recordset.
    VB6 sp5, SQL Server 2000, C#

    There are no stupid questions. Only stupid people.

  3. #3
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    Hi again kovan

    Yes if you set it to nothing you have to re-set it.

    if you need to use the recordset again, use rs.close and when you come to terminate your app, then set it to nothing

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  4. #4
    Fanatic Member Gary.Lowe's Avatar
    Join Date
    May 2000
    Location
    In my sphere of influence
    Posts
    621
    Kovan

    i found this useful to close recordsets without erros

    Code:
        If Not rstTemp Is Nothing Then
            rstTemp.Close
            Set rstTemp = Nothing
        End If
    I f I have any recordsets in a project I just create a function with the above for each recordset, database, workspace, then I know every thing has been closed properly.
    Gary Lowe
    VB6 (Enterprise) SP5
    ADO 2.6
    SQL Server 7 SP3

    OK I know my spelling and grammer is crap so don't quote me on it!

    To err is human to take the P! is only natural !!

    Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width