PDA

Click to See Complete Forum and Search --> : Datagrid Control ADO


MJK
Jan 18th, 2000, 11:17 AM
Hi,
Does anyone know how to set the datagrid
to an existing ADODB Recordset?

I've been trying the following but nothing happens :-

set datagrid1.datasource = rs

Any help would be very welcome

Clunietp
Jan 18th, 2000, 11:24 AM
This code works fine for me:


Dim cn As ADODB.Connection
Dim rs As New Recordset

Set cn = New Connection

cn.Open "Provider=SQLOLEDB.1;Data Source=NTSRV;Integrated Security=SSPI;Initial Catalog=Northwind"

rs.Open "Select * from customers", cn, adOpenStatic, adLockReadOnly

Set Me.DataGrid1.DataSource = rs