What binds recordset to connection object? 
Author Message
 What binds recordset to connection object?

Hello,
(this might seem like a stupid question)
In the following example, what binds the recordset to the connection object?

  Dim cnn As New ADODB.Connection
  Dim rst As New ADODB.Recordset
  Dim fld As ADODB.Field

  ' Open the connection
  cnn.Open _
    "Provider=Microsoft.Jet.OLEDB.4.0;" _
    & "Data Source=.\NorthWind.mdb;"

  ' Open the forward-only,
  ' read-only recordset
  rst.Open "SELECT * FROM Customers " & _
    "WHERE Region = 'WA'", cnn, _
    adOpenForwardOnly, adLockReadOnly

Thanks,
Karl
www.excelbus.com



Sat, 09 Oct 2004 00:44:56 GMT  
 What binds recordset to connection object?
Karl,

The second argument to the Recordset.Open method is a reference to an
*opened* Connection object (or optionally, a connection string, and the
Recordset creates its own Connection object from that connection string)

regards
Roy Fine


Quote:
> Hello,
> (this might seem like a stupid question)
> In the following example, what binds the recordset to the connection
object?

>   Dim cnn As New ADODB.Connection
>   Dim rst As New ADODB.Recordset
>   Dim fld As ADODB.Field

>   ' Open the connection
>   cnn.Open _
>     "Provider=Microsoft.Jet.OLEDB.4.0;" _
>     & "Data Source=.\NorthWind.mdb;"

>   ' Open the forward-only,
>   ' read-only recordset
>   rst.Open "SELECT * FROM Customers " & _
>     "WHERE Region = 'WA'", cnn, _
>     adOpenForwardOnly, adLockReadOnly

> Thanks,
> Karl
> www.excelbus.com



Sat, 09 Oct 2004 00:58:57 GMT  
 What binds recordset to connection object?
Hi,

Inside Open method there is second parameter, where you
pass connection. Another way is to assign connection
explicitely before open recordset

Set Rst.ActiveConnection=cnn

Val

Quote:
>-----Original Message-----
>Hello,
>(this might seem like a stupid question)
>In the following example, what binds the recordset to the
connection object?

>  Dim cnn As New ADODB.Connection
>  Dim rst As New ADODB.Recordset
>  Dim fld As ADODB.Field

>  ' Open the connection
>  cnn.Open _
>    "Provider=Microsoft.Jet.OLEDB.4.0;" _
>    & "Data Source=.\NorthWind.mdb;"

>  ' Open the forward-only,
>  ' read-only recordset
>  rst.Open "SELECT * FROM Customers " & _
>    "WHERE Region = 'WA'", cnn, _
>    adOpenForwardOnly, adLockReadOnly

>Thanks,
>Karl
>www.excelbus.com

>.



Sat, 09 Oct 2004 01:27:18 GMT  
 What binds recordset to connection object?
Thanks Guys... I new that was a simple one : )

Karl
www.excelbus.com/info-m


Quote:
> Hi,

> Inside Open method there is second parameter, where you
> pass connection. Another way is to assign connection
> explicitely before open recordset

> Set Rst.ActiveConnection=cnn

> Val

> >-----Original Message-----
> >Hello,
> >(this might seem like a stupid question)
> >In the following example, what binds the recordset to the
> connection object?

> >  Dim cnn As New ADODB.Connection
> >  Dim rst As New ADODB.Recordset
> >  Dim fld As ADODB.Field

> >  ' Open the connection
> >  cnn.Open _
> >    "Provider=Microsoft.Jet.OLEDB.4.0;" _
> >    & "Data Source=.\NorthWind.mdb;"

> >  ' Open the forward-only,
> >  ' read-only recordset
> >  rst.Open "SELECT * FROM Customers " & _
> >    "WHERE Region = 'WA'", cnn, _
> >    adOpenForwardOnly, adLockReadOnly

> >Thanks,
> >Karl
> >www.excelbus.com

> >.



Sat, 09 Oct 2004 01:36:25 GMT  
 What binds recordset to connection object?
You passed the connection object (cnn) as one of the
parameters in the rs.open method call.

Stewart

Quote:
>-----Original Message-----
>Hello,
>(this might seem like a stupid question)
>In the following example, what binds the recordset to the
connection object?

>  Dim cnn As New ADODB.Connection
>  Dim rst As New ADODB.Recordset
>  Dim fld As ADODB.Field

>  ' Open the connection
>  cnn.Open _
>    "Provider=Microsoft.Jet.OLEDB.4.0;" _
>    & "Data Source=.\NorthWind.mdb;"

>  ' Open the forward-only,
>  ' read-only recordset
>  rst.Open "SELECT * FROM Customers " & _
>    "WHERE Region = 'WA'", cnn, _
>    adOpenForwardOnly, adLockReadOnly

>Thanks,
>Karl
>www.excelbus.com

>.



Sat, 09 Oct 2004 04:49:30 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. opening connection object, recordset object

2. Data bound controls using Adodc and ADO connection object

3. Recordset & Bound Object Frame

4. Combo box bound to ADO recordset object?

5. Combo box bound to ADO Recordset object?

6. Binding Label Object to RecordSet in code

7. Data designer bound controls seem to lose their binding to the recordset with Requery

8. Finding a record in a Bound recordset (bound using the DataEnvironment)

9. Data designer bound controls seem to lose their binding to the recordset with Requery

10. Finding a record in a Bound recordset (bound using the DataEnvironment)

11. errors different when executing SQL statements via recordset or connection object

12. Number of recordsets hanging off a connection object

 

 
Powered by phpBB® Forum Software