Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. private void TypComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
  2. {
  3. ComboBox comboBox = (ComboBox)sender;
  4. SqlCommand command = new SqlCommand("SELECT nazwa FROM wszystkie_produkty WHERE Kategoria = @kategoria Typ = @typ");
  5. command.Parameters.AddWithValue("@kategoria", KategoriaComboBox.SelectedItem.ToString());
  6. command.Parameters.AddWithValue("@typ", TypComboBox.SelectedItem.ToString());
  7.  
  8. if (dataSet.Tables.Contains("Produktyy"))
  9. {
  10. dataSet.Tables.Remove(dataSet.Tables["Produktyy"]);
  11. }
  12. dataSet = baza_zapytan.DodajTabeleDataSet(command, new string[] { "Produktyy" }, ref dataSet);
  13. ProduktComboBox.Items.Clear();
  14. foreach (DataRow row in dataSet.Tables["Produktyy"].Rows)
  15. {
  16. ProduktComboBox.Items.Add(row["nazwa"].ToString());
  17. }
  18. if (produkt_ID > 0)
  19. {
  20. ProduktComboBox.SelectedItem = dataSet.Tables["Produkt"].Rows[0]["nazwa"].ToString();
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement