Error 07001 in jdbc
843854Dec 16 2001 — edited Dec 17 2001I created a prepared statement and I fill it with items from an object. but now I get an strange error, which I can't understand. I hope maybe someone can help me
here is the error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 16.
I really don't understand the error because I have only 14 values that I have to fill in. the table only consist of 14 values and persoon_id is the primary key
Here is the code:
public int UPDATE_Persoon(Persoon p, Connection con) throws RemoteException
{ if (con!=null)
{ String sql = "UPDATE persoon SET titel= ? , voornaam= ? , tussenvoegsel= ? " +
", achternaam= ? , adres= ? , postcode= ? , woonplaats= ? , geslacht= ? " +
", geb_datum= ? , telefoon= ? , fax= ? , email= ? , type= ? WHERE persoon_id= ? ;";
try
{ PreparedStatement ps = con.prepareStatement(sql);
ps.setString(1, p.getTitel());
ps.setString(2, p.getVoornaam());
ps.setString(3, p.getTussenvoegsel());
ps.setString(4, p.getAchternaam());
ps.setString(5, p.getAdres());
ps.setString(6, p.getPostcode());
ps.setString(7, p.getWoonplaats());
ps.setString(8, p.getGeslacht());
ps.setString(9, p.getGeb_datum());
ps.setString(10, p.getTelefoon());
ps.setString(11, p.getFax());
ps.setString(12, p.getEmail());
ps.setInt(13, p.getType());
ps.setInt(14, p.getPersoonID());
ps.executeUpdate();
}
catch (Exception ex)
{ throw new RemoteException("error on changing persoon: " + p.getPersoonID());
}
}
else
{ throw new RemoteException("Error on database connection");
}
return 1; //Everything went allright
}