Often, you may want to reuse a recordset object in the same procedure. For
instance, you may want to open a new SQL statement. If so, you may have wondered
if it was necessary to destroy a recordset object before reusing it again, as in
the following:
Fortunately, destroying the recordset object variable isn't necessary. ADO lets
you reuse a recordset as much as you like, so long as you close it first. As a
result, you could modify the above pseudo-code to look something like this:
'process first RS
Set RS = New ADODB.Recordset
RS.Open SQL, Conn, ....
' do something with the RS
RS.Close
Set RS = Nothing
'process second RS
Set RS = New ADODB.Recordset
RS.Open SQL, Conn, ....
' do something with the RS
RS.Close
Set RS = NothingSet RS = New ADODB.Recordset
'process first RS
RS.Open SQL, Conn, ....
' do something with the RS
RS.Close
'process second RS
RS.Open SQL, Conn, ....
' do something with the RS
RS.Close
Set RS = Nothing
Reuse ADO recordsets
By ElementK Journals, published on 18 Jul 2001
| Filed in
You might also like...
SQL forum discussion
-
ASP Login page to convert to HTML5
by ss2013 (0 replies)
-
Asp.Net practical books related
by ravi1985.k@gmail.com (0 replies)
-
How to use Zebra Printing TPL 2844 in web pages using c#
by muqeet.522 (0 replies)
-
SEO Company in London
by webdesigningukco (0 replies)
-
About software training for beginner
by sudarshan380 (0 replies)
SQL podcasts
-
Hanselminutes: Startup Series: Buying an Existing Small Company or Online Application
Published 10 months ago, running time 0h34m
Scott talks to Rob Walling about how he purchases small niche products and companies online and revitalizes them. He recently purchased an existing product that consisted of a 300 gig database and tens of thousands of lines of Classic ASP. How did he know it was valuable? What's next?
Comments