Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset closing question

Status
Not open for further replies.

dragonturtle

Programmer
Sep 25, 2003
55
CA
Hi,

Sorry if this is a silly question, but I don't know where to look. Which is more "efficient"? This first block which gets rid of rs after several queries...

Code:
sql = "SELECT * FROM tblOne"
Set rs = Conn.Execute(sql)
  a_one = rs.GetRows

sql = "SELECT * FROM tblTwo"
Set rs = Conn.Execute(sql)
  a_two = rs.GetRows

Set rs = Nothing

or this next block which gets rid of the recordset after each query?

Code:
sql = "SELECT * FROM tblOne"
Set rs = Conn.Execute(sql)
  a_one = rs.GetRows
Set rs = Nothing

sql = "SELECT * FROM tblTwo"
Set rs = Conn.Execute(sql)
  a_two = rs.GetRows
Set rs = Nothing
 
I would be suprised if the performance difference were more than 1/1000th of a second...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Technically, I believe that the first one is the better answer. mwofl00 is right that you probably won't tell the difference, but from a technical point, the fact that you aren't recreating the RS object each time, should save your server some work, and make life easier on you.



The money's gone, the brain is shot.....but the liquor we still got.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top