0

Hi I am attempting an insert statement but keep getting the following error:

java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 3.

Here is my code:

 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();
     }
4

3 回答 3

1

You're missing a comma between DOB and ChipNum. Pay a little attention to what you're writing.

于 2013-08-02T12:00:57.293 回答
0

我想 DOB 和 chipnum 是两个独立的字段。如果是这样,它们必须用逗号分隔。

于 2013-08-02T12:04:11.063 回答
0

你应该在 DOB 和 ChipNum 之间加一个逗号吗?

于 2013-08-02T12:01:59.340 回答