dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB6,VBS
Expertise: beginner
Jul 24, 1999

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Reuse a Recordset's Connection

ADO lets you create a Recordset without creating an explicit Connection object, using the following syntax:


Dim rs As New ADODB.Recordset
rs.Open "Authors", "DSN=Pubs"
If you later want to create another Recordset, but you (correctly) don't want to create another database connection, you can reuse the implicit Connection object that ADO has created for the first Recordset, as in:

Dim rs2 As New ADODB.Recordset
Set rs2.ActiveConnection = rs.ActiveConnection
rs2.Open "Publishers"
or, more simply, with

Dim rs2 As New ADODB.Recordset
rs2.Open "Publishers", rs.ActiveConnection
Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date