[英]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. ps是PreparedStatement,该字段的数据类型为DATE。 how can i set it to Null not to "0000-00-00".
我如何将其设置为Null而不是“ 0000-00-00”。
Call this.. 叫这个
ps.setNull(1, java.sql.Types.Date);
where java.sql.Types.Date
is SQL Datatype 其中
java.sql.Types.Date
是SQL数据类型
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.