private void button_searchBooking(object sender, RoutedEventArgs e) { if (search_booking.Text.Any(c => Char.IsLetterOrDigit(c) || Char.IsWhiteSpace(c))) { //stores what's in the Searchbox in a variable string id = search_booking.Text; //creates the SQL query string query = @"SELECT * FROM Bookings WHERE Booking_Id = '" + id + "';"; DBConnection connection = DBConnection.getDBConnectionInstance(); DataSet bookingData = connection.getDataSet(query); //checks that the query returned exactly one result int count = bookingData.Tables[0].Rows.Count; if (count == 1) { booking_screen booking = new booking_screen(id, bookingData); booking.Show(); } else { MessageBox.Show("No booking found."); } } else { MessageBox.Show("No booking found."); } }
private void bt_booking_Click(object sender, RoutedEventArgs e) { this.Hide(); booking_screen frm = new booking_screen(); frm.Show(); this.Close(); }