Hello, first post =D

Seemingly simple question, but I can't seem to find the solution.

(above were other SQL statements I had been fooling with)



            da = New MySqlDataAdapter(SQL, conn)

            Dim cb As MySqlCommandBuilder = New MySqlCommandBuilder(da)
            da.Fill(ds, "products")

            dgvMain.DataSource = ds
            dgvMain.DataMember = "products"

            'ComboBox1.DataSource = ds.Tables("products")
            'ComboBox1.DisplayMember = "products_model"

            ComboBox1.DataSource = ds.Tables("products")
            ComboBox1.DisplayMember = "Tables_in_my_database"


The remarked area works fine when I'm accessing a specific table. I've successfully inserted the products_model field into the combobox too.

The datagridview does show the table names in the db using the SHOW TABLES sql statment, but I'm not understanding how to get this info into the combobox instead.

Any ideas?

Thanks !

You can use something like -

Dim dt As New DataTable = DS.Tables(0)
    Dim dr As DataRow

For Each dr In dt.Rows()
       combo.Items.Add(dr("Description"))'What field data to add
    combo.SelectedIndex = -1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.