Results 1 to 2 of 2

Thread: datagrid and msflexgrid

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2000
    Posts
    168
    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

  2. #2
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Columbia, SC USA
    Posts
    374

    Talking try this

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width