Closing an implicit RecordSet

Results 1 to 3 of 3

Thread: Closing an implicit RecordSet

  1. #1
    BobR Guest

    Default Closing an implicit RecordSet

    I often re-use a recordset on an ASP page that is created implicitly using: "Set rs = conn.Execute(SQL)"<BR>If I need other results I then change the SQL and issue another "Set rs = conn.Execute(SQL)" and finally "rs.close" and "set rs = nothing" at the end of the script. <BR>Should I be calling "rs.close" in between all of the "Set rs=" assignments? I guess my question is, when you call "set rs" over and over again, are you reusing the object, or are you creating new instances and losing the handle of the original resulting in memory leaks? Thanks.

  2. #2
    Join Date
    Dec 1969

    Default RE: Closing an implicit RecordSet

    When you do<BR>Set rs = objConn.Execute(strSQL)<BR><BR>the second time, the following steps happen implicitly:<BR><BR>1.) rs.Close<BR>2.) Set rs = Nothing<BR>3.) Set rs = Server.CreateObject("ADODB.Recordset")<BR>4.) rs.Open strSQL, objConn<BR><BR>If you want to explicitly use the Close method, go for it.

  3. #3
    BobR Guest

    Default RE: Closing an implicit RecordSet

    That explains a lot. Thanks for the help Scott!

Posting Permissions

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