Setting Recordsets to Nothing in VB6

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David C. Barber

    Setting Recordsets to Nothing in VB6

    Why is it that after I close an ADO recordset defined locally

    Dim adoRS as New ADODC.Recordset

    that so many examples insist that I should set it to nothing as well?

    adoRS.Close
    Set adoRS = Nothing
    Exit Sub

    Isn't it sufficient to have it go out of scope when I exit the subroutine?

    Thanks!

    *David*


  • Henning

    #2
    SV: Setting Recordsets to Nothing in VB6

    It's all in the Help!
    Optional. Discontinues association of objectvar with any specific object.
    Assigning Nothing to objectvar releases all the system and memory resources
    associated with the previously referenced object when no other variable
    refers to it.
    /Henning

    "David C. Barber" <david@NOSPAMdb arber.com> skrev i meddelandet
    news:oJ6dnVs7wf YkAjPcRVn-gg@comcast.com. ..[color=blue]
    > Why is it that after I close an ADO recordset defined locally
    >
    > Dim adoRS as New ADODC.Recordset
    >
    > that so many examples insist that I should set it to nothing as well?
    >
    > adoRS.Close
    > Set adoRS = Nothing
    > Exit Sub
    >
    > Isn't it sufficient to have it go out of scope when I exit the subroutine?
    >
    > Thanks!
    >
    > *David*
    >
    >[/color]


    Comment

    Working...