1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| String req1="SELECT id_bureau FROM bureau WHERE Num_Bureau='"+bureau+"'";
String req2="SELECT id_dprtm FROM departement WHERE Nom_dprtm='"+departement+"'";
PreparedStatement stmt1=connect.prepareStatement("INSERT INTO bureau(Num_Bureau) values ('"+bureau+"')");
stmt1.executeUpdate();
ResultSet rs1=st.executeQuery(req1);
while(rs1.next()){
IdBureau = rs1.getInt(1);
}
PreparedStatement stmt2=connect.prepareStatement("INSERT INTO departement(Nom_dprtm) values ('"+departement+"')");
stmt2.executeUpdate();
ResultSet rs2=st.executeQuery(req2);
while(rs2.next()){
IdDprtm = rs2.getInt(1);
}
PreparedStatement stmt= connect.prepareStatement("INSERT INTO user(id_cat,id_bureau,id_dprtm,NomUser,PrenomUser,NumTel,Adresse,Email,Sexe,Identifiant,Password) values ('"+IdCat+"','"+IdBureau+"','"+IdDprtm+"','"+nom+"','"+prenom+"','"+tel+"','"+adresse+"','"+email+"','"+sexe+"','"+pseudo+"','"+password+"')");
stmt.executeUpdate(); |
Partager