Guest User

Untitled

a guest
Jan 22nd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. try
  2. {
  3. cobPitch.Items.Clear();
  4. cobPitch.Update();
  5. Pitchs.Clear();
  6. reader.Close();
  7.  
  8. connection.Open();
  9.  
  10. command.Connection = connection;
  11.  
  12. command.CommandText = @"SELECT StandplaatsID, Standplaatsnaam, BezetStatus FROM Standplaats WHERE BezetStatus = @value";
  13. command.Parameters.AddWithValue("@value", 0);
  14.  
  15. reader = command.ExecuteReader();
  16.  
  17. while(reader.Read())
  18. {
  19. Pitch pitch = new Pitch(reader.GetInt32(0), reader.GetString(1), reader.GetInt32(2));
  20. Pitchs.Add(pitch);
  21. cobPitch.Items.Add(pitch);
  22. }
  23.  
  24. reader.Close();
  25. connection.Close();
  26. }
  27.  
  28. catch (Exception ex)
  29. {
  30. MessageBox.Show(ex.Message);
  31. }
  32.  
  33. finally
  34. {
  35. connection.Close();
  36. }
Add Comment
Please, Sign In to add comment