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
-
Invitation to take part in an academic research study
by researchlab (0 replies)
-
How to insert & edit unique value using store procedure
by umeshdaiya (0 replies)
-
How to troubleshoot Epson laser printer?
by daisywyatt618 (0 replies)
-
view state is stored after the page post-back
by shriniwas.khatri852 (0 replies)
-
Transfer selected rows from one GridView to another GridView in aspxform(ASP.NET)
by dorsa (0 replies)
SQL podcasts
-
Hanselminutes: Startup Series: Buying an Existing Small Company or Online Application
Published 8 years 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