1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| query="INSERT INTO table_utilisateurs (id_ile,pseudo,mot_de_passe,email,date_naissance,date_inscription) VALUES (?,?,?,?,?,?)";
this.connect();
try {
PreparedStatement prepare = this.getConnect().prepareStatement(query);
prepare.setInt(1, this.idIle);
prepare.setString(2, this.pseudo);
prepare.setString(3, motDePasseCrypte);
prepare.setString(4, this.email);
prepare.setLong(5, naissanceMillis);
prepare.setLong(6, jourdhuiMillis);
prepare.executeUpdate();
prepare.close();
query="SELECT LAST_INSERT_ID() AS id";
Statement state=this.getConnect().createStatement();
ResultSet result=state.executeQuery(query);
result.next();
this.id=result.getString("id"); |
Partager