简体   繁体   中英

How to setNull on the MYSQL Database (Date Datatype)

con = DriverManager.getConnection(Module.url, Module.username, Module.password);
String sql = "Update resume set Start = ? where ID = '" + ID.getText() + "'";
ps = con.prepareStatement(sql);
ps.setNull(1, 0);
ps.executeUpdate();

ps is PreparedStatement, the datatype of the field is DATE. how can i set it to Null not to "0000-00-00".

Call this..
ps.setNull(1, java.sql.Types.Date);
where java.sql.Types.Date is SQL Datatype

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM