1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| @WebMethod(operationName = "ajoutdiplomecandidat ")
public String ajoutdiplome(String iddiplome, @WebParam(name = "titre")
String titre, @WebParam(name = "candidat_cin") String candidat_cin) {
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/dbws","root","root");
PreparedStatement st2 = con.prepareStatement("insert into diplome values(?,?,?) ");
PreparedStatement req = con.prepareStatement("select Max(cin) from candidat)");
ResultSet res=req.executeQuery();
candidat_cin = res.getString(1);
st2.setString(1,iddiplome);
st2.setString(2,titre);
st2.setString(3,candidat_cin);
st2.executeUpdate();
} |
Partager