String sql = "INSERT INTO user (userid, username, password, lastname, firstname, "
+ "middlename, birthdate, gender, address, email, contact, "
+ "marital_status, religion) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)";
try {
pst = conn.prepareStatement(sql);
pst.setString(1, username);
pst.setString(2, password.toString()); //chartype
pst.setString(3, lastName);
pst.setString(4, firstName);
pst.setString(5, middleName);
pst.setString(6, birthdate);
pst.setString(7, gender1);
pst.setString(8, address1);
pst.setString(9, email1);
pst.setLong(10, mobile);
pst.setString(11, status1);
pst.setString(12, religion1);
pst.execute();
}catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
我有 13 列,用户 ID 是自动递增的。但我不知道你不需要输入用户ID是怎么做的。
我得到了这个错误。我想要自动增量 ID。所以不需要输入对吗?
Column count doesn't match value count at row 1