Hello I am using ADO connections/recordsets connection to an ms access 97 db. is there a way to set the datagrid or msflexgrid to show the ado recordset without using an ado or dao control?
thanks,
Thai
Printable View
Hello I am using ADO connections/recordsets connection to an ms access 97 db. is there a way to set the datagrid or msflexgrid to show the ado recordset without using an ado or dao control?
thanks,
Thai
Set references to Microsoft Access Object Library and Microsoft ActiveX Data Object 2.0 Library, then
Code:Private myCN As ADODB.Connection
Private myRS As New ADODB.Recordset
Private Sub Form_Load()
Set myCN = New ADODB.Connection
With myCN
.ConnectionString = Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=C:\My Documents\myDatabase.mdb
.CursorLocation = adUseClient
.Open
End With
If myRS.State = adStateOpen Then
myRS.Close
End If
myRS.Open "Select * From MyTable Order By MY_FIELD", myCN, adOpenKeyset, adLockOptimistic
Set DataGrid1.DataSource = myRS
End Sub