I have combobox for the type of room and 2 text boxes for the Arrival and Departure, What I want is when the Arrival = 2017-09-01 - Departure = 2017-09-05 is already exist, The customer will not able to choose 2017-09-02 to 2017-09-05 in the same type of room
String sql = "SELECT * FROM reservation WHERE room=? and arrival=? and
departure=?";
try{
pst=conn.prepareStatement(sql);
pst.setString(1, ComboBox.getSelectedItem().toString());
pst.setString(2, txtArrival.getText());
pst.setString(3, txtDeparture.getText());
rs=pst.executeQuery();
if(rs.next()){
// the customer needs to choose other date or room
}
else{
// continue to fill up the form below
}
}