I have four columns in my table:
Item_name
Brand
Model
Price
I need to show results when I select an Item_name
. When I select another oil, then show those result.
Private Sub ComboBox7_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox7.SelectedIndexChanged
Dim cmd As New SqlCommand
cmd.Connection = cn
cmd.CommandText = "SELECT * FROM Table_14 WHERE Item_Name='" & ComboBox7.Text & "'"
Dim adapter As New SqlDataAdapter(cmd)
Dim table As New DataTable()
adapter.Fill(table)
If table.Rows.Count() > 0 Then
ComboBox2.Text = table.Rows(0)(1).ToString()
ComboBox3.Text = table.Rows(0)(2).ToString()
TextBox1.Text = table.Rows(0)(3).ToString()
End If
End Sub