Calendar cal;
String sql = "INSERT INTO ttable (dt) values (?);"
//dt is a dateTime field in ttable
PreparedStatement stmt = connection.prepareStatement(sql);
stmt = setDate(1,cal); //not working
stmt.execute();
stmt.close();
我想將cal轉換爲插入表的Date類型。如何在Java中將日曆轉換爲java.sql.Date?
想必你想'java.sql.Date'而不是'java.util.Date'? – ArtB 2014-03-14 14:26:34