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

Opening and Closing Record Sets

Status
Not open for further replies.

Horsegag9

Technical User
Jan 25, 2005
9
0
0
AU
Hi Guys,

What do I need to do to read from more than one recordset within a single script? Do I need to close the Conn and RS first.

Any scripting samples would be great thanks.

Horse
 
Generally speaking, it is better to close your database connection and recordsets as quickly as possible because they use server resources. Not much, but when lots of users are connected it could make a big difference.

In your case, I would keep the connection open, use a separate object for each recordset. Don't create the recordset object until you are ready for it, then close it as soon as you are done with it. Create the next recordset object, use it, close it. And so on.

Hope it helps.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Also you can just reuse the same recordset if the data that you need from each is used on discreet areas of your output page. Simply close it after you output the first dataset and then re-open it with the second source.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top