I have a form on my program, and I have two comboboxes that I want to fill with data from columns in my database. I've tried three or four different ways that I've found searching around the web, but none of them seem to be working. They don't produce errors, but they don't load the combos either. For clarity, I've tried to bind them to the database, I've tried using datasets, and tried datatables. The code I've been working with is below. Can anyone offer a suggestion to get this working for me? Thanks!
con.Open() 'load hotel dropdown Dim cmd As OleDbCommand = New OleDbCommand("SELECT Hotel FROM Hotels ORDER BY Hotel", con) Dim dt As New DataTable() Dim da As New OleDbDataAdapter() da.SelectCommand = cmd da.Fill(dt) Dim r As DataRow For Each r In dt.Rows cmb_hotel.Items.Add(r(1).ToString) Next 'load restaurant dropdown cmd = New OleDbCommand("SELECT Rest_Name FROM Restaurants ORDER BY Rest_Name", con) Dim dt1 As New DataTable() Dim da1 As New OleDbDataAdapter() da1.SelectCommand = cmd da1.Fill(dt) Dim r1 As DataRow For Each r1 In dt.Rows cmb_restaurant.Items.Add(r1(1).ToString) Next con.Close()