您应该使用
PreparedStatement和使用
setNull(int,int):
String sql = "INSERT INTO temp(val) VALUES (?)";PreparedStatement st = con.prepareStatement(sql);if () { st.setInt(1, value);} else { set.setNull(1, Types.INTEGER);}count = st.executeUpdate();
您应该使用
PreparedStatement和使用
setNull(int,int):
String sql = "INSERT INTO temp(val) VALUES (?)";PreparedStatement st = con.prepareStatement(sql);if () { st.setInt(1, value);} else { set.setNull(1, Types.INTEGER);}count = st.executeUpdate();