waffle

waffle

  • NA
  • 48
  • 0

populate 2nd combobox based on the 1st combobox

Apr 3 2007 3:17 AM
i want to update my second combo box based on the choice on the first combobox. what is the simplest way to do this? i had my first combobox works. ok.. so far, this is my code for the 1st combobox using (SqlConnection conn = new SqlConnection(Properties.Settings.Default.dbConnectionString)) { SqlDataAdapter da = new SqlDataAdapter("SELECT [CategoryName] FROM Categories",conn); DataSet ds = new DataSet(); daCat.Fill(ds,"Categories"); comboBox1.DataSource = ds.Tables["Categories"]; comboBox1.DisplayMember = "CategoryName"; } i don't know how the code for second combobox will start. but the sql will say something like this.. select productname from products where categoryID=combobox1.text

Answers (9)