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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO recordset

Status
Not open for further replies.

JonoB

Programmer
May 29, 2003
147
GB
Typically, when using ADO recordsets, I like to keep everything nice and tidy. So, I always end off with the following:

cnn.close
set cnn = nothing
rsRecordset.close
set rsRecordset = nothing

However, there are times when I want to keep a recordset open all the time, especially when the underlying data only changes every day or so. By doing this, the user doesnt have to generate the recordset every time they need to use it.

However, this means that I have to keep the connection and the recordset open all the time.

Given that the recordset is currently returning about 450 records (only 2 fields per record), is this bad programming? Does keeping the connection and recordset open waste resources and hog memory?

Thanks for the help!
 
Have you looked into disconnected recordsets? This might fill the bill for you.

Sam
 
Depending on how you use the data you may be able to use the GetRows method and store the data in an array.

In the tidy up process I would always deal with the recordset before the connection, not sure if there is any good reason it just seems logical based on the order they are opened.

 
I do use the GetRows method anyway.

Regarding disconnected recordset's - yes I have looked into it.

Thanks for the posts.
 
On second thoughts I dont think I really answered the two questions.

Is it bad programming and does it waste resources and hog memory - Probably yes to the purist. I believe the recommended way is to always close recordsets and connections as soon as possible after use, which I do. However sometimes thats when the app ends...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top