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);
}
I have 13 columns and userid is autoincrement. But I don't know how do that you don't need to put the user id.
And I got this error. And I want Auto Increment ID. So no need to input right?
Column count doesn't match value count at row 1