I have a table named IsSELECTED with 4 fields:
(date (DATETIME), morning (BOOL), noon(BOOL), night(BOOL))
which has 1 record (2015-06-08, FALSE, FALSE, FALSE).
In my servlet, I want to select this record. So, I have this query:
String timeStamp = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
ResultSet rs = stmt.executeQuery( "SELECT morning, noon, night FROM IsSELECTED WHERE time=" + timeStamp);
if (!rs.next()){
System.out.println("nulllll");
}else{
Shift s = new Shift(rs.getBoolean("morning"), rs.getBoolean("noon"), rs.getBoolean("night"));
}
}
and I get nullll. what is wrong?
Aucun commentaire:
Enregistrer un commentaire