Results 1 to 2 of 2

Thread: [RESOLVED] ADO combo box

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Posts
    71

    [RESOLVED] ADO combo box

    How can I populate a Bind a combo box to data stored in a table (tblActivity) using ADO via code?
    so far I have been able to connect to the database, the code below represent my progress so far




    Code:
    'created the variable conn that represents a new instance of 
    'OleDb.Connection Object
    
    Dim conn As New OleDb.OleDbConnection
        
    'created the variable DataSet that represents a new instance of the object DataSet
    Dim DataSet As New DataSet
    
    'create the variable DataAdapter as an instance of OleDB.OleDbDataApapter
     Dim DataAdapter As OleDb.OleDbDataAdapter
    
      
    
    Dim sql As String
       
    Public Sub PopulateActivity()
    
            conn.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source =" _
            & Application.StartupPath & "\TSDB.mdb"
    
            conn.Open()
    
            sql = "SELECT Activity FROM tblActivity"
    
            DataAdapter = New OleDb.OleDbDataAdapter(sql, conn)
    
            DataAdapter.Fill(DataSet, "Activity")
    
    
    
            conn.Close()
    
    End Sub
    Last edited by cedtech23; Nov 30th, 2006 at 09:20 AM.

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