我想DOB和chipnum是两个独立的字段。如果是这样,它们必须用逗号分隔。
嗨,我正在尝试插入语句,但一直收到以下错误:
java.sql.sql异常:[Microsoft][ODBC Microsoft Access Driver]也几个参数。应为3。
这是我的代码:
try {
Statement stmt = con.createStatement();
String mySqlStatement = "INSERT INTO EntrantDetails (ID, Name, Surname, Gender, DOB ChipNum) VALUES (" + details.getIDNum()+ "," + details.getName() + "," + details.getSurname() + "," + details.getGender() + "," + details.getDOB() + "," + details.getChipNum() + ")";
stmt.executeUpdate(mySqlStatement);
}
catch (Exception ex)
{
ex.printStackTrace();
}
DOB和ChipNum之间缺少一个逗号。注意你写的东西。
DOB和ChipNum之间应该有逗号吗?