0
我有空间类型的组合框和到达和离开的两个文本框, 我想要的是什么时候到达= 2017-09-01 - 出发= 2017 -09-05已经存在,客户将无法在同类型的房间选择2017年9月2日至2017年9月5日如何在Java中迭代到达和离开日期,Mysql
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
}
}
_“它不会接受它”_。请更具体地说明您的问题或您想要做的事情。 –
我更新了它,对不起 – Francis
你的意思是说,你有一个房间,而且这个房间可以预订,数据库存储开始/结束。那么如果其他人要预订这个房间,并输入开始/结束,那么你想搜索房间是否可用? – forqzy