1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
   |  
 
 private void btnajoutActionPerformed(java.awt.event.ActionEvent evt) {                                         
        try{
            boolean b=false;
            for(int j=0;j<dt.getRowCount();j++){
            if( Integer.parseInt(txtid.getText())==dt.getValueAt(j, 0) ){
            b=true;
            break;
            }
            }
            if(b==false){
            St.executeUpdate("insert into stg values("+txtid.getText()+",'"+txtnom.getText()+"','"+txtprenom.getText()+"',"+txtdate.getDateFormatString()+",'"+txtage.getText()+"',"+txtsexe.getText()+"',"+txtadresse.getText()+",'"+txtdatecreation.getText()+"')");
           afficherpatient(); //recharger la list des patient
            JOptionPane.showMessageDialog(null, "Patient(e) est ajouté(e) !!! \n");
            }
            else
            {
                JOptionPane.showMessageDialog(null, "Numero Patient(e) existe deja  !!! \n");
            }
 
            //ajout de patient
St.executeUpdate("insert into stg values("+txtid.getText()+",'"+txtnom.getText()+"','"+txtprenom.getText()+"',"+txtdate.getDateFormatString()+",'"+txtage.getText()+"',"+txtsexe.getText()+"',"+txtadresse.getText()+",'"+txtdatecreation.getText()+"')");
             JOptionPane.showMessageDialog(null, "Patient(e) est ajouté(e) !!! \n");
        }
 
        catch(Exception e){
 JOptionPane.showMessageDialog(null, "Erreur d'ajout d'un(e) patient(e) !!! \n" +e.getMessage());
        }
    } | 
Partager