Re bonour Tout le Monde. Enfait j'ai 2 tables , je veux inserer avec 2 requetes comme le montre le code cidessous:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
   // ENREGISTREMMENT
        String nom = txtnm.getText();
        String prnm = txtpr.getText();
        String sexe = txtda.getText();
        String adr = txtad.getText();
        String tel = txttel.getText();
        String mdp = txtmdp.getText();
        Object stat = txtstat.getSelectedItem();
        Object fonc = txtfnct.getSelectedItem();
 
        String req1 = "INSERT INTO profil (idFonction,idStatut) select idFonction,idStatut from fonction,statut Where nomFonction='" + fonc + "' And nomStatut='" + stat + "' ";
        String req = "INSERT INTO PROFIL(nom,prenom,sexe,adresse,tel,password) VALUES ('" + nom + "','" + prnm + "','" + sexe + "','" + adr + "','" + tel + "','" + mdp + "')";
 
        try {
            stmt.executeUpdate(req);
            stmt.executeUpdate(req1);
 
            JOptionPane.showMessageDialog(null, "Insertion Reussie");
 
        } catch (SQLException e) {
            JOptionPane.showMessageDialog(null, "Erreur d'enregistrement\n" + e.getLocalizedMessage());
 
        }
Mais a chaque fois que j'execute il y'a erreur, "Field Nom doesn't Have a default Value", bien sur ça dit que Nom n'a pas de valeure par defaut mais je comprend pas le rapport! ! Eclairez moi svp...Cordialemment