Results 1 to 4 of 4

Thread: dtagrid w/o using adodc

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2008
    Posts
    29

    dtagrid w/o using adodc

    hi.Did anyone here knew how to add data to datagrid view w/o using Adodc Control...I want to write the code in adodb form

  2. #2

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: dtagrid w/o using adodc

    Or, my control of choice, the ListView.

    DataGrids are bound controls and therefore, require a data control to work.

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: dtagrid w/o using adodc

    Simply open an ADO Recordset (must be client side) and set the DataGrid's DataSource property.

    Code:
    Private Sub Command1_Click()
        Dim rs As ADODB.Recordset
        
        Set rs = New ADODB.Recordset
        rs.CursorLocation = adUseClient
        
        rs.Open "Select * From Customers", "provider=microsoft.jet.oledb.4.0;data source=c:\projects\northwind2002.mdb", adOpenStatic, adLockReadOnly
        
        Set DataGrid1.DataSource = rs
        Set rs = Nothing
        
    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