Connection/Recordset or just Recordset

Connection/Recordset or just Recordset

Post by Pauline Ohania » Thu, 06 Apr 2000 04:00:00



Hi,
I want to know which one is better for getting records from databases:

Assuming I'm using VB:

Dim adConnection As ADODB.Connection
Dim rsList As ADODB.Recordset
Set adConnection = New ADODB.Connection
Set rsList = New ADODB.Recordset
adConnection.Open GetConnectionString()
Set rsList = adConnection.Execute(SQLStm)

OR
Dim rsList As ADODB.Recordset
rsList.Open SQLStm, GetConnectionString(), adOpenForwardOnly, adLockReadOnly

In the first way, I'm using an extra Connection object. So, which one is
better and which one is faster?

TIA,
Pauline

 
 
 

Connection/Recordset or just Recordset

Post by Matthew Band » Thu, 06 Apr 2000 04:00:00


There is probably little noticeable difference in speed with today's PC
hardware either way.  The advantage of using the connection object really
occurs when you have multiple recordsets or commands that can all utilize
the same connection.

Matthew Bando


>Hi,
>I want to know which one is better for getting records from databases:

>Assuming I'm using VB:

>Dim adConnection As ADODB.Connection
>Dim rsList As ADODB.Recordset
>Set adConnection = New ADODB.Connection
>Set rsList = New ADODB.Recordset
>adConnection.Open GetConnectionString()
>Set rsList = adConnection.Execute(SQLStm)

>OR
>Dim rsList As ADODB.Recordset
>rsList.Open SQLStm, GetConnectionString(), adOpenForwardOnly,
adLockReadOnly

>In the first way, I'm using an extra Connection object. So, which one is
>better and which one is faster?

>TIA,
>Pauline