Populate VB DataGrid from Recordset
Could someone please help me and complete the following sub procedure.
(I am not sure if I should ask this Q on in the VB area?)
I have a Datagrid placed on a Visual Basic Form.
When I open the form, I want the Datagrid to be populated with data from a select
query.
(Could you also please let me know which library references to use.)
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Private Sub Form_Load()
Set cnn = New ADODB.Connection
cnn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;
Persist Security Info=False;Initial Catalog=Northwind;Data Source=SQLServer"
cnn.Open
Set rst = New ADODB.Recordset
.
.
.
.
Set DataGrid1.DataSource = rst
End Sub