Link to home
Start Free TrialLog in
Avatar of designaire
designaireFlag for United States of America

asked on

vb.net populate combobox from access database

I can't seem to populate this ComboBox from an access database. The Error is in the SQL statement. The table name is Lists and the column I want to use in the combobox is instructorList. It worked when I was using asp.net but now I have to convert it to a windows application and I can't make it work.
cnstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\data.mdb;"
        cn = New OleDbConnection(cnstring)
 
        SQLstring = "SELECT * FROM Lists"
 
        Dim cmd As New OleDbCommand(cnstring, cn)
        da = New OleDbDataAdapter(cnstring, cn)
        ds = New DataSet
        da.Fill(ds, "data")
 
        combox1.DataSource = ds.Tables(0)
        combox1.DisplayMember = "data"
        combox1.ValueMember = "instructorList"

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of designaire
designaire
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial