IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Composants Java Discussion :

[JComboBox] Erreur lors de la recupération d'une valeur


Sujet :

Composants Java

  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Juillet 2010
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2010
    Messages : 70
    Par défaut [JComboBox] Erreur lors de la recupération d'une valeur
    je suis sur le point de la finalisation de mon projet en fait il me reste juste la programmation de deux bouton (enregister et créer)

    enregistrer c'est pour enregistrer une modification effectuées sur l'interface graphique d'intervention alors le bouton Creer c'est pour creer une nouvelle intervention

    bon mon problème c'est que ni la requete de la modification ni la création d'une nouvelle intervention ne se s'exécute; je soupçonne les JCombobox puisque j'ai deux Jcombobx (Mpay:mode de paiement et Stat: Statut ) dans ces deux requete et j'ai d'autre requete sans JCombobox qui fonctionne super bien.

    je vous laisse le code des deux classe (modification et création) au cas ou si vous reperez l'erreur

    merci encore une fois
    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
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
     
    Modification
     
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.text.ParseException;
    import javax.swing.JFormattedTextField;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JLabel;
    import javax.swing.text.MaskFormatter;
    public class Finterventionintermodify extends JFrame {      private static final long serialVersionUID = 1L;
        public Finterventionintermodify(){      //Définit une taille pour celle-ci ;
            ici, 400 px de large et 500 px de haut   this.setSize(1280, 770);
            //Nous allons maintenant dire à notre objet de se positionner au centre   this.setLocationRelativeTo(null);
            //Instanciation d'un objet JPanel   JPanel pan = new JPanel();
            //Définition de sa couleur de fond   pan.setBackground(Color.white);
            //On prévient notre JFrame que pan ça sera notre JPanel (contentPane)   this.setContentPane(pan);
            setLayout(null);
            /*   On crée un panal (conteneur) et on lui donne une couleur pourqu'il soit lisible    On déclare de panel comme panel principal    On Crée un label   On ajoute ce label au panel    On défini un layoutManager (FlowLayout)   On attache le layoutManager au panel   */         JLabel Titre=new JLabel(" Fiche d'Intervention Interne ");
            Titre.setFont(new Font("TimesRoman", Font.BOLD, 40));
            Titre.setForeground(Color.red);
            Titre.setBounds(400,50,700,35);
            pan.add(Titre);
            JLabel Ninterinter = new JLabel("N° d'intervention : ");
            Ninterinter.setFont(new Font("TimesRoman", Font.BOLD, 25));
            Ninterinter.setForeground(Color.red);
            Ninterinter.setBounds(100,150,300,25);
            pan.add(Ninterinter);
            final JLabel Ninter = new JLabel(Interventioninter.Nveninter);
            Ninter.setFont(new Font("TimesRoman", Font.BOLD, 20));
            Ninter.setForeground(Color.red);
            Ninter.setBounds(360,155,200,20);
            pan.add(Ninter);
            JLabel Prob = new JLabel("Problématique : ");
            Prob.setFont(new Font("TimesRoman", Font.BOLD, 25));
            Prob.setForeground(Color.red);
            Prob.setBounds(100,230,300,25);
            pan.add(Prob);
            final JTextField Pb = new JTextField(Interventioninter.Pveninter);
            Pb.setBounds(360,235,200,20);
            pan.add(Pb);
            JLabel cout = new JLabel("Coût : ");
            cout.setFont(new Font("TimesRoman", Font.BOLD, 25));
            cout.setForeground(Color.red);
            cout.setBounds(100,310,300,25);
            pan.add(cout);
            final JTextField Ct = new JTextField(Interventioninter.Cveninter);
            Ct.setBounds(360,315,200,20);
            pan.add(Ct);
            JLabel date1 = new JLabel("Date d'entrée : ");
            date1.setFont(new Font("TimesRoman", Font.BOLD, 25));
            date1.setForeground(Color.red);
            date1.setBounds(770,150,300,25);
            pan.add(date1);
            final JLabel Denter = new JLabel(Interventioninter.Dentreinter);
            Denter.setFont(new Font("TimesRoman", Font.BOLD, 20));
            Denter.setForeground(Color.red);
            Denter.setBounds(1030,155,200,20);
            pan.add(Denter);
            /*   try{  MaskFormatter Date1 = new MaskFormatter("##-##-####");
                Date1.setValidCharacters("0123456789");
                Date1.install(Denter);
                Denter.setBounds(1030,155,200,20);
                pan.add(Denter);
            }
            catch(ParseException e){   e.printStackTrace();
            }
            */      JLabel Dinter = new JLabel("Date d'intervention : ");
            Dinter.setFont(new Font("TimesRoman", Font.BOLD, 25));
            Dinter.setForeground(Color.red);
            Dinter.setBounds(770,230,300,25);
            pan.add(Dinter);
            final JFormattedTextField Dateinter = new JFormattedTextField(Interventioninter.Dinterveninter );
            Dateinter.setBounds(1030,235,200,20);
            pan.add(Dateinter);
            /*   try{   MaskFormatter Date2 = new MaskFormatter("##-##-####");
                Date2.setValidCharacters("0123456789");
                Date2.install(Dateinter);
                Dateinter.setBounds(1030,235,200,20);
                pan.add(Dateinter);
            }
            catch(ParseException e){   e.printStackTrace();
            }
            */        JLabel Dfac = new JLabel("Date de facturation : ");
            Dfac.setFont(new Font("TimesRoman", Font.BOLD, 25));
            Dfac.setForeground(Color.red);
            Dfac.setBounds(770,310,300,25);
            pan.add(Dfac);
            final JFormattedTextField Dfacture = new JFormattedTextField(Interventioninter.Dfacturinter);
            Dfacture.setBounds(1030,315,200,20);
            pan.add(Dfacture);
            /*    try{  MaskFormatter Date3 = new MaskFormatter("##-##-####");
                Date3.setValidCharacters("0123456789");
                Date3.install(Dfacture);
                Dfacture.setBounds(1030,315,200,20);
                pan.add(Dfacture);
            }
            catch(ParseException e){   e.printStackTrace();
            }
            */      JLabel Dsor = new JLabel("Date de sortie : ");
            Dsor.setFont(new Font("TimesRoman", Font.BOLD, 25));
            Dsor.setForeground(Color.red);
            Dsor.setBounds(100,390,300,25);
            pan.add(Dsor);
            final JFormattedTextField Dsortie = new JFormattedTextField(Interventioninter.Dsorinter);
            Dsortie.setBounds(360,395,200,20);
            pan.add(Dsortie);
            /*  try{  MaskFormatter Date4 = new MaskFormatter("##-##-####");
                Date4.setValidCharacters("0123456789");
                Date4.install(Dsortie);
                Dsortie.setBounds(360,395,200,20);
                pan.add(Dsortie);
            }
            catch(ParseException e){  e.printStackTrace();
            }
            */  JLabel Description = new JLabel("Description  : ");
            Description.setFont(new Font("TimesRoman", Font.BOLD, 25));
            Description.setForeground(Color.red);
            Description.setBounds(100,470,250,25);
            pan.add(Description);
            final TextArea Descrip = new TextArea(Interventioninter.Descripinter);
            Descrip.setBounds(360,475,870,50);
            pan.add(Descrip);
            JLabel ModP = new JLabel("Mode de paiement : ");
            ModP.setFont(new Font("TimesRoman", Font.BOLD, 25));
            ModP.setForeground(Color.red);
            ModP.setBounds(100,550,300,25);
            pan.add(ModP);
            final JComboBox Mpay = new JComboBox();
            Mpay.addItem("Espèce");
            Mpay.addItem("Carte Bancaire");
            Mpay.addItem("Chèque");
            Mpay.setBounds(360,555,200,23);
            pan.add(Mpay);
            JLabel Statut = new JLabel("Statut : ");
            Statut.setFont(new Font("TimesRoman", Font.BOLD, 25));
            Statut.setForeground(Color.red);
            Statut.setBounds(770,550,300,25);
            pan.add(Statut);
            final JComboBox Stat = new JComboBox();
            Stat.addItem("En cours");
            Stat.addItem("En attente");
            Stat.addItem("Invalide");
            Stat.addItem("Closed");
            Stat.setBounds(1030,555,200,23);
            pan.add(Stat);
            JButton Save = new JButton("Enregistrer");
            Save.setBounds(583,620,170,25);
            pan.add(Save);
            Save.addActionListener(new ActionListener() {   public void actionPerformed(ActionEvent e) {   // Cette méthode ne sera appelée que pour les évènements sur le bouton monBouton.      // chaine de connexion  final String url = "jdbc:odbc:dbrescue";
                    Connection con = null;
                    Statement requete = null;
                    ResultSet resultat1 = null;
                    try {  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
                        con = DriverManager.getConnection(url,"","");
                        requete = con.createStatement();
                        int resultat = requete.executeUpdate("update Interventioninter set DATE_ENTREE='"+Denter.getText()+"', DATE_INTERINT='"+Dateinter.getText()+"', DATE_FACTURATION='"+Dfacture.getText()+"', DATE_SORTIE= '"+Dsortie.getText()+"', PROBLEMATIQUE='"+Pb.getText()+"', DESCRIPTION='"+Descrip.getText()+"', COUT='"+Ct.getText()+"', MODE_PAIEMENT= '"+Mpay.getSelectedItem()+"', INTSTATUT= '"+Stat.getSelectedItem()+"' from Interventioninter where N_INTERINT ="+Interventioninter.Nveninter+" ");
                        JOptionPane.showMessageDialog(null,"Votre intervention a été bien modifiée" );
                        // Labeltest.setText(Numclient+ Nomclient + Ntelclient);
                        Fclient Fclient = new Fclient();
                        Fclient.setVisible(true);
                        dispose();
                    }
                    catch (ClassNotFoundException e1) {  // TODO Auto-generated catch block  e1.printStackTrace();
                    }
                    catch (SQLException e2) {  // TODO Auto-generated catch block  e2.printStackTrace();
                    }
                    catch (Exception e3) {  e3.printStackTrace();
                    }
                    finally {   try {con.close();
                            requete.close();
                            resultat1.close();
                        }
                        catch(final SQLException e1) {e1.printStackTrace();
                        }
                    }
                }
            }
            );
            JButton Anl = new JButton("Annuler");
            Anl.setBounds(583,660,170,25);
            pan.add(Anl);
            Anl.addActionListener(new ActionListener() {   public void actionPerformed(ActionEvent e) {        Finterventioninter Finterventioninter=new Finterventioninter();
                    dispose();
                }
            }
            );
            //Ferme-toi lorsqu'on clique sur "Fermer" !   this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            // mettre la fenetre visible    this.setVisible(true);
        }
    }


    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
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
     
     
    Nouvelle
     
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.text.ParseException;
    import javax.swing.JFormattedTextField;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    import javax.swing.text.MaskFormatter;
    public class Newfinterventioninter extends JFrame {      private static final long serialVersionUID = 1L;
        JTextField Pb=null;
        JTextField Ct=null;
        JFormattedTextField Denter=null;
        JFormattedTextField Dateinter=null;
        JFormattedTextField Dfacture =null;
        JFormattedTextField Dsortie=null;
        TextArea Descrip=null;
        JComboBox Mpay=null;
        JComboBox Stat=null;
        public Newfinterventioninter(){      //Définit une taille pour celle-ci ;
            ici, 400 px de large et 500 px de haut   this.setSize(1280, 770);
            //Nous allons maintenant dire à notre objet de se positionner au centre   this.setLocationRelativeTo(null);
            //Instanciation d'un objet JPanel   JPanel pan = new JPanel();
            //Définition de sa couleur de fond   pan.setBackground(Color.white);
            //On prévient notre JFrame que pan ça sera notre JPanel (contentPane)   this.setContentPane(pan);
            setLayout(null);
            JLabel Titre=new JLabel(" Fiche d'Intervention Interne ");
            Titre.setFont(new Font("TimesRoman", Font.BOLD, 40));
            Titre.setForeground(Color.red);
            Titre.setBounds(400,50,700,35);
            pan.add(Titre);
            JLabel Ninterinter = new JLabel("N° d'intervention : ");
            Ninterinter.setFont(new Font("TimesRoman", Font.BOLD, 25));
            Ninterinter.setForeground(Color.red);
            Ninterinter.setBounds(100,150,300,25);
            pan.add(Ninterinter);
            JTextField Ninter = new JTextField();
            Ninter.setBounds(360,155,200,20);
            pan.add(Ninter);
            JLabel Prob = new JLabel("Problématique : ");
            Prob.setFont(new Font("TimesRoman", Font.BOLD, 25));
            Prob.setForeground(Color.red);
            Prob.setBounds(100,230,300,25);
            pan.add(Prob);
            JTextField Pb = new JTextField();
            Pb.setBounds(360,235,200,20);
            pan.add(Pb);
            JLabel cout = new JLabel("Coût : ");
            cout.setFont(new Font("TimesRoman", Font.BOLD, 25));
            cout.setForeground(Color.red);
            cout.setBounds(100,310,300,25);
            pan.add(cout);
            JTextField Ct = new JTextField();
            Ct.setBounds(360,315,200,20);
            pan.add(Ct);
            JLabel date1 = new JLabel("Date d'entrée : ");
            date1.setFont(new Font("TimesRoman", Font.BOLD, 25));
            date1.setForeground(Color.red);
            date1.setBounds(770,150,300,25);
            pan.add(date1);
            final JFormattedTextField Denter = new JFormattedTextField();
            try{  MaskFormatter Date1 = new MaskFormatter("##-##-####");
                Date1.setValidCharacters("0123456789");
                Date1.install(Denter);
                Denter.setBounds(1030,155,200,20);
                pan.add(Denter);
            }
            catch(ParseException e){   e.printStackTrace();
            }
            JLabel Dinter = new JLabel("Date d'intervention : ");
            Dinter.setFont(new Font("TimesRoman", Font.BOLD, 25));
            Dinter.setForeground(Color.red);
            Dinter.setBounds(770,230,300,25);
            pan.add(Dinter);
            final JFormattedTextField Dateinter = new JFormattedTextField();
            try{   MaskFormatter Date2 = new MaskFormatter("##-##-####");
                Date2.setValidCharacters("0123456789");
                Date2.install(Dateinter);
                Dateinter.setBounds(1030,235,200,20);
                pan.add(Dateinter);
            }
            catch(ParseException e){  e.printStackTrace();
            }
            JLabel Dfac = new JLabel("Date de facturation : ");
            Dfac.setFont(new Font("TimesRoman", Font.BOLD, 25));
            Dfac.setForeground(Color.red);
            Dfac.setBounds(770,310,300,25);
            pan.add(Dfac);
            final JFormattedTextField Dfacture = new JFormattedTextField();
            try{  MaskFormatter Date3 = new MaskFormatter("##-##-####");
                Date3.setValidCharacters("0123456789");
                Date3.install(Dfacture);
                Dfacture.setBounds(1030,315,200,20);
                pan.add(Dfacture);
            }
            catch(ParseException e){   e.printStackTrace();
            }
            JLabel Dsor = new JLabel("Date de sortie  : ");
            Dsor.setFont(new Font("TimesRoman", Font.BOLD, 25));
            Dsor.setForeground(Color.red);
            Dsor.setBounds(100,390,300,25);
            pan.add(Dsor);
            final JFormattedTextField Dsortie = new JFormattedTextField();
            try{  MaskFormatter Date4 = new MaskFormatter("##-##-####");
                Date4.setValidCharacters("0123456789");
                Date4.install(Dsortie);
                Dsortie.setBounds(360,395,200,20);
                pan.add(Dsortie);
            }
            catch(ParseException e){   e.printStackTrace();
            }
            JLabel Description = new JLabel("Description  : ");
            Description.setFont(new Font("TimesRoman", Font.BOLD, 25));
            Description.setForeground(Color.red);
            Description.setBounds(100,470,250,25);
            pan.add(Description);
            final TextArea Descrip = new TextArea();
            Descrip.setBounds(360,475,870,50);
            pan.add(Descrip);
            JLabel ModP = new JLabel("Mode de paiement : ");
            ModP.setFont(new Font("TimesRoman", Font.BOLD, 25));
            ModP.setForeground(Color.red);
            ModP.setBounds(100,550,300,25);
            pan.add(ModP);
            final JComboBox Mpay = new JComboBox();
            Mpay.addItem("Espèce");
            Mpay.addItem("Chèque");
            Mpay.addItem("Carte Bancaire");
            Mpay.setBounds(360,555,200,23);
            pan.add(Mpay);
            JLabel Statut = new JLabel("Statut : ");
            Statut.setFont(new Font("TimesRoman", Font.BOLD, 25));
            Statut.setForeground(Color.red);
            Statut.setBounds(770,550,300,25);
            pan.add(Statut);
            final JComboBox Stat = new JComboBox();
            Stat.addItem("En attente");
            Stat.addItem("En cours");
            Stat.addItem("Closed");
            Stat.addItem("Invalide");
            Stat.setBounds(1030,555,200,23);
            pan.add(Stat);
            JButton create = new JButton(" Créer  ");
            create.setBounds(583,620,170,25);
            pan.add(create);
            create.addActionListener(new ActionListener() {   public void actionPerformed(ActionEvent e) {   final String url = "jdbc:odbc:dbrescue";
                    Connection con = null;
                    Statement requete = null;
                    try {  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
                        con = DriverManager.getConnection(url,"","");
                        requete = con.createStatement();
                        int resultat = requete.executeUpdate("insert into Interventioninter (DATE_ENTREE, DATE_INTERINT, DATE_FACTURATION, DATE_SORTIE, PROBLEMATIQUE, DESCRIPTION, COUT, MODE_PAIEMENT, INTSTATUT, N_CLIENT) values ('"+Denter.getText()+"', '"+Dateinter.getText()+"', '"+Dfacture.getText()+"', "+Dsortie.getText()+", "+Descrip.getText()+", '"+Mpay.getSelectedItem()+"', '"+Stat.getSelectedItem()+"') where N_CLIENT="+Rclient.Nmclient+" ");
                        JOptionPane.showMessageDialog(null,"Utilisateur crée avec succes" );
                        Rclient Rclient = new Rclient();
                        Rclient.setVisible(true);
                        dispose();
                    }
                    catch (ClassNotFoundException e1) {  // TODO Auto-generated catch block  e1.printStackTrace();
                    }
                    catch (SQLException e2) {  // TODO Auto-generated catch block  e2.printStackTrace();
                    }
                    catch (Exception e3) {  e3.printStackTrace();
                    }
                    finally {   try {con.close();
                            requete.close();
                        }
                        catch(final SQLException e1) {e1.printStackTrace();
                        }
                    }
                }
            }
            );
            JButton Anl = new JButton(" Annuler  ");
            Anl.setBounds(583,660,170,25);
            pan.add(Anl);
            Anl.addActionListener(new ActionListener() {   public void actionPerformed(ActionEvent e) {       Interventioninter Interventioninter = new Interventioninter();
                    dispose();
                }
            }
            );
            //Ferme-toi lorsqu'on clique sur "Fermer" !   this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            // mettre la fenetre visible    this.setVisible(true);
        }
    }

  2. #2
    Membre chevronné
    Profil pro
    Inscrit en
    Avril 2008
    Messages
    342
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2008
    Messages : 342
    Par défaut
    salut,

    euh balises CODE stp

    et tu peut nous mettre que les parties de ton code que tu soupçonne de posé problème stp

    Merci d'avance

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Juillet 2010
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2010
    Messages : 70
    Par défaut
    Salut

    désolé j'ai pas fait attention
    bon la partie que je soupçonne pour la classe de modification c'est celle du bouton enregistrer précisement la requete SQL

  4. #4
    Membre confirmé
    Profil pro
    Inscrit en
    Juillet 2010
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2010
    Messages : 70
    Par défaut
    salut désolé je suis un petit peu stressé alors pardonnez moi cette fois ci

    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
    25
    26
    27
    28
    29
    30
    31
    32
    33
    JButton Save = new JButton("Enregistrer");
    Save.setBounds(583,620,170,25);
    pan.add(Save);
    Save.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Cette méthode ne sera appelée que pour les évènements sur le bouton monBouton. // chaine de connexion final String url = "jdbc:odbc:dbrescue";
    Connection con = null;
    Statement requete = null;
    ResultSet resultat1 = null;
    try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    con = DriverManager.getConnection(url,"","");
    requete = con.createStatement();
    int resultat = requete.executeUpdate("update Interventioninter set DATE_ENTREE='"+Denter.getText()+"', DATE_INTERINT='"+Dateinter.getText()+"', DATE_FACTURATION='"+Dfacture.getText()+"', DATE_SORTIE= '"+Dsortie.getText()+"', PROBLEMATIQUE='"+Pb.getText()+"', DESCRIPTION='"+Descrip.getText()+"', COUT='"+Ct.getText()+"', MODE_PAIEMENT= '"+Mpay.getSelectedItem()+"', INTSTATUT= '"+Stat.getSelectedItem()+"' from Interventioninter where N_INTERINT ="+Interventioninter.Nveninter+" ");
    JOptionPane.showMessageDialog(null,"Votre intervention a été bien modifiée" );
    // Labeltest.setText(Numclient+ Nomclient + Ntelclient);
    Fclient Fclient = new Fclient();
    Fclient.setVisible(true);
    dispose();
    }
    catch (ClassNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace();
    }
    catch (SQLException e2) { // TODO Auto-generated catch block e2.printStackTrace();
    }
    catch (Exception e3) { e3.printStackTrace();
    }
    finally { try {con.close();
    requete.close();
    resultat1.close();
    }
    catch(final SQLException e1) {e1.printStackTrace();
    }
    }
    }
    }
    );
    Pour la partie de la classe de la nouvelle intervention est le bouton Créer




    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
    25
    26
    27
    28
    29
    30
    JButton create = new JButton(" Créer ");
    create.setBounds(583,620,170,25);
    pan.add(create);
    create.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final String url = "jdbc:odbc:dbrescue";
    Connection con = null;
    Statement requete = null;
    try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    con = DriverManager.getConnection(url,"","");
    requete = con.createStatement();
    int resultat = requete.executeUpdate("insert into Interventioninter (DATE_ENTREE, DATE_INTERINT, DATE_FACTURATION, DATE_SORTIE, PROBLEMATIQUE, DESCRIPTION, COUT, MODE_PAIEMENT, INTSTATUT, N_CLIENT) values ('"+Denter.getText()+"', '"+Dateinter.getText()+"', '"+Dfacture.getText()+"', "+Dsortie.getText()+", "+Descrip.getText()+", '"+Mpay.getSelectedItem()+"', '"+Stat.getSelectedItem()+"') where N_CLIENT="+Rclient.Nmclient+" ");
    JOptionPane.showMessageDialog(null,"Utilisateur crée avec succes" );
    Rclient Rclient = new Rclient();
    Rclient.setVisible(true);
    dispose();
    }
    catch (ClassNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace();
    }
    catch (SQLException e2) { // TODO Auto-generated catch block e2.printStackTrace();
    }
    catch (Exception e3) { e3.printStackTrace();
    }
    finally { try {con.close();
    requete.close();
    }
    catch(final SQLException e1) {e1.printStackTrace();
    }
    }
    }
    }
    );
    [/CODE][/CODE]
    Merci de me repondre le plus tot possible

  5. #5
    Membre Expert
    Avatar de slim_java
    Homme Profil pro
    Enseignant
    Inscrit en
    Septembre 2008
    Messages
    2 272
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2008
    Messages : 2 272
    Par défaut
    Citation Envoyé par patriot Voir le message
    mon problème c'est que ni la requete de la modification ni la création d'une nouvelle intervention ne se s'exécute;
    peux tu donner le strakTrace ?

  6. #6
    Membre confirmé
    Profil pro
    Inscrit en
    Juillet 2010
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2010
    Messages : 70
    Par défaut
    Salut

    je suis désolé je suis encore debutant en java alors je comprend pas qu'est tu veux dire par strakTrace

    merci

  7. #7
    Membre Expert
    Avatar de slim_java
    Homme Profil pro
    Enseignant
    Inscrit en
    Septembre 2008
    Messages
    2 272
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2008
    Messages : 2 272
    Par défaut
    Citation Envoyé par patriot Voir le message
    qu'est tu veux dire par strakTrace
    Dans chaque bloc
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    try
    {
    }
     catch ( ...... e)
    {
     e.printStackTrace();
    }
    tu mets un e.printStackTrace() dans la partie catch et tu récupère la trace de l'erreur .on a besoin de connaitre ces traces pour pouvoir te répondre

  8. #8
    Membre confirmé
    Profil pro
    Inscrit en
    Juillet 2010
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2010
    Messages : 70
    Par défaut
    Salut

    comme je te disais moi je suis pas si fort en java alors tous ce qui est exception je l'ai copier coller d'une autre classe ou un code similaire d'enregistrement fonctionne. je te laisse le code qui fonctionne en précisant que la seule diifrence entre les deux code que un contient deux Jcombobx(listes déroulantes) et l'autre non.

    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
    25
    26
    27
    Save.addActionListener(new ActionListener() {   public void actionPerformed(ActionEvent e) {     final String url = "jdbc:odbc:dbrescue";
            Connection con = null;
            Statement requete = null;
            try {   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
                con = DriverManager.getConnection(url,"","");
                requete = con.createStatement();
                int resultat = requete.executeUpdate("update Client set NOM='"+Nomc.getText()+"', PRENOM='"+Prec.getText()+"', ADRESSE='"+Adress.getText()+"', N_TELFIXE= '"+Ntel.getText()+"', N_TELMOBILE= '"+Ntelm.getText()+"', EMAIL='"+Email.getText()+"' where N_CLIENT="+Nclient.getText()+"");
                JOptionPane.showMessageDialog(null,"Votre compte a été bien modifié" );
                Rclient Rclient = new Rclient();
                Rclient.setVisible(true);
                dispose();
            }
            catch (ClassNotFoundException e1) {   // TODO Auto-generated catch block   e1.printStackTrace();
            }
            catch (SQLException e2) {   // TODO Auto-generated catch block   e2.printStackTrace();
            }
            catch (Exception e3) {   e3.printStackTrace();
            }
            finally {   try {con.close();
                    requete.close();
                }
                catch(final SQLException e1) {e1.printStackTrace();
                }
            }
        }
    }
    );

  9. #9
    Membre Expert
    Avatar de slim_java
    Homme Profil pro
    Enseignant
    Inscrit en
    Septembre 2008
    Messages
    2 272
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2008
    Messages : 2 272
    Par défaut
    Difficile de t'aider sans la trace d'erreur
    Faut que tu sache que
    la méthode d'un JComboBox retourne un Object et non un String

    aussi, je t'invite à vérifier tes requête car si on prend la classe Newfinterventioninter, Dsortie et Descrip sont des JTextField, donc si tu fais
    ca va retourner un String, hors dans ta reqéte tu fais .. il faut donc faire
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    '"+Dsortie.getText()+"'
    méme chose pour .
    Vérifie bien tes requêtes sinon tu peux utiliser la classe PreparedStatement

  10. #10
    Membre confirmé
    Profil pro
    Inscrit en
    Juillet 2010
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2010
    Messages : 70
    Par défaut
    Salut

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    la méthode 
    getSelectedItem
     
    d'un JComboBox retourne un Object et non un String

    Effectivement là tas bien reperé l'erreur moi je veux que mon JComboBox recupère un String alors j'ai besoin de la syntaxe si tu l'as.

    je m'explique; j'ai deux listes déroulante dans une j'ai defni trois statut de mon intervention (En cours, En attente, Closed) et dans une autre j'ai defini une le mode de paiement(espere, carte bancaire, cheque) alors si je modifier ou je créer une nouvelle intervention le code doit prendre en considération la modification des listes déroulantes autrement je veux que mon code enregistre la valeur récupérer à partir de mon JCombobox dans ma base de données.
    Ps: pour les '' de Dsortie et Descrip c'est bon je les ai modifié

    je te laisse quand meme la liste des message d'erreur que eclipse me genère tout en précisant que la ligne 237 est celle de la requete SQL ou j'ai les Jcombobox



    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
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    java.sql.SQLException: ResultSet is closed
    	at sun.jdbc.odbc.JdbcOdbcResultSet.checkOpen(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcResultSet.clearWarnings(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcResultSet.close(Unknown Source)
    	at Rclient$1.actionPerformed(Rclient.java:209)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Le nombre de valeurs de la requête doit coïncider avec le nombre de champs destination.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    	at Newfinterventioninter$1.actionPerformed(Newfinterventioninter.java:237)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Le nombre de valeurs de la requête doit coïncider avec le nombre de champs destination.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    	at Newfinterventioninter$1.actionPerformed(Newfinterventioninter.java:237)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Le nombre de valeurs de la requête doit coïncider avec le nombre de champs destination.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    	at Newfinterventioninter$1.actionPerformed(Newfinterventioninter.java:237)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Le nombre de valeurs de la requête doit coïncider avec le nombre de champs destination.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    	at Newfinterventioninter$1.actionPerformed(Newfinterventioninter.java:237)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Le nombre de valeurs de la requête doit coïncider avec le nombre de champs destination.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    	at Newfinterventioninter$1.actionPerformed(Newfinterventioninter.java:237)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Le nombre de valeurs de la requête doit coïncider avec le nombre de champs destination.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    	at Newfinterventioninter$1.actionPerformed(Newfinterventioninter.java:237)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Merci encore une fois

  11. #11
    Membre Expert
    Avatar de slim_java
    Homme Profil pro
    Enseignant
    Inscrit en
    Septembre 2008
    Messages
    2 272
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2008
    Messages : 2 272
    Par défaut
    Citation Envoyé par patriot Voir le message
    je veux que mon JComboBox recupère un String alors j'ai besoin de la syntaxe si tu l'as.
    suffit de faire un cast avec
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    (String) comboBox.getSelectedItem()

  12. #12
    Membre confirmé
    Profil pro
    Inscrit en
    Juillet 2010
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2010
    Messages : 70
    Par défaut
    Salut


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    suffit de faire un cast avec
     
    Code :
    (String) comboBox.getSelectedItem()

    mais je fais comment pour rentre cette commande dans ma requete SQL ???




    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    int	resultat = requete.executeUpdate("insert into Interventioninter (DATE_ENTREE, DATE_INTERINT, DATE_FACTURATION, DATE_SORTIE, PROBLEMATIQUE, DESCRIPTION, COUT, MODE_PAIEMENT, INTSTATUT, N_CLIENT) values ('"+Denter.getText()+"', '"+Dateinter.getText()+"', '"+Dfacture.getText()+"', '"+Dsortie.getText()+"', '"+Descrip.getText()+"', '"+Mpay.getSelectedItem()+"', '"+Stat.getSelectedItem()+"') where N_CLIENT="+Rclient.Nmclient+" ");

    merci d'avance

  13. #13
    Membre Expert
    Avatar de slim_java
    Homme Profil pro
    Enseignant
    Inscrit en
    Septembre 2008
    Messages
    2 272
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2008
    Messages : 2 272
    Par défaut
    Citation Envoyé par patriot Voir le message
    mais je fais comment pour rentre cette commande dans ma requete SQL ???
    comme je dis toujours : "la simplicité fait la beauté"

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    String val1 = (String) Stat.getSelectedItem();
    String val2 = (String) Mpay.getSelectedItem();
     
    int    resultat = requete.executeUpdate("insert into Interventioninter (DATE_ENTREE, DATE_INTERINT, DATE_FACTURATION, DATE_SORTIE, PROBLEMATIQUE, DESCRIPTION, COUT, MODE_PAIEMENT, INTSTATUT, N_CLIENT) values ('"+Denter.getText()+"', '"+Dateinter.getText()+"', '"+Dfacture.getText()+"', '"+Dsortie.getText()+"', '"+Descrip.getText()+"', '"+val2+"', '"+val1+"') where N_CLIENT="+Rclient.Nmclient+" ");

  14. #14
    Membre confirmé
    Profil pro
    Inscrit en
    Juillet 2010
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2010
    Messages : 70
    Par défaut
    Salut


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    String val1 = (String) Stat.getSelectedItem();
    String val2 = (String) Mpay.getSelectedItem();
     
    int    resultat = requete.executeUpdate("insert into Interventioninter (DATE_ENTREE, DATE_INTERINT, DATE_FACTURATION, DATE_SORTIE, PROBLEMATIQUE, DESCRIPTION, COUT, MODE_PAIEMENT, INTSTATUT, N_CLIENT) values ('"+Denter.getText()+"', '"+Dateinter.getText()+"', '"+Dfacture.getText()+"', '"+Dsortie.getText()+"', '"+Descrip.getText()+"', '"+val2+"', '"+val1+"') where N_CLIENT="+Rclient.Nmclient+" ");__________________


    J'ai testé ton code mais malheureusement ne fonctionne pas, je te laisse la listes des message d'erreur que j'ai eu sachant bien que la ligne 239 c'est celle de la requete SQL



    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
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    java.sql.SQLException: ResultSet is closed
    	at sun.jdbc.odbc.JdbcOdbcResultSet.checkOpen(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcResultSet.clearWarnings(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcResultSet.close(Unknown Source)
    	at Rclient$1.actionPerformed(Rclient.java:209)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Le nombre de valeurs de la requête doit coïncider avec le nombre de champs destination.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    	at Newfinterventioninter$1.actionPerformed(Newfinterventioninter.java:239)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Le nombre de valeurs de la requête doit coïncider avec le nombre de champs destination.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    	at Newfinterventioninter$1.actionPerformed(Newfinterventioninter.java:239)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Le nombre de valeurs de la requête doit coïncider avec le nombre de champs destination.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    	at Newfinterventioninter$1.actionPerformed(Newfinterventioninter.java:239)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Le nombre de valeurs de la requête doit coïncider avec le nombre de champs destination.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    	at Newfinterventioninter$1.actionPerformed(Newfinterventioninter.java:239)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Le nombre de valeurs de la requête doit coïncider avec le nombre de champs destination.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    	at Newfinterventioninter$1.actionPerformed(Newfinterventioninter.java:239)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Le nombre de valeurs de la requête doit coïncider avec le nombre de champs destination.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    	at Newfinterventioninter$1.actionPerformed(Newfinterventioninter.java:239)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Le nombre de valeurs de la requête doit coïncider avec le nombre de champs destination.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    	at Newfinterventioninter$1.actionPerformed(Newfinterventioninter.java:239)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Le nombre de valeurs de la requête doit coïncider avec le nombre de champs destination.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    	at Newfinterventioninter$1.actionPerformed(Newfinterventioninter.java:239)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)

  15. #15
    Membre Expert
    Avatar de slim_java
    Homme Profil pro
    Enseignant
    Inscrit en
    Septembre 2008
    Messages
    2 272
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2008
    Messages : 2 272
    Par défaut
    dans quel bloc ty/catch tu as écris ce message
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Le nombre de valeurs de la requête doit coïncider avec le nombre de champs destination

  16. #16
    Membre confirmé
    Profil pro
    Inscrit en
    Juillet 2010
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2010
    Messages : 70
    Par défaut
    Salut


    je pense que c'est dans ce Catch

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    } catch (SQLException e2) {
                					// TODO Auto-generated catch block
                					e2.printStackTrace();

    puisque devant ce message j'ai SQLException

  17. #17
    Membre Expert
    Avatar de slim_java
    Homme Profil pro
    Enseignant
    Inscrit en
    Septembre 2008
    Messages
    2 272
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2008
    Messages : 2 272
    Par défaut
    dans la table il ya 10 champs :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    DATE_INTERINT,
    DATE_FACTURATION, 
    DATE_SORTIE,
    PROBLEMATIQUE, 
    DESCRIPTION, 
    COUT, 
    MODE_PAIEMENT,
    INTSTATUT,
    N_CLIENT
    alors que tu fournies seulement 7 valeur dans
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    int    resultat = requete.executeUpdate("insert into Interventioninter (DATE_ENTREE, DATE_INTERINT, DATE_FACTURATION, DATE_SORTIE, PROBLEMATIQUE, DESCRIPTION, COUT, MODE_PAIEMENT, INTSTATUT, N_CLIENT) values ('"+Denter.getText()+"', '"+Dateinter.getText()+"', '"+Dfacture.getText()+"', '"+Dsortie.getText()+"', '"+Descrip.getText()+"', '"+val2+"', '"+val1+"') where N_CLIENT="+Rclient.Nmclient+" ");

  18. #18
    Membre confirmé
    Profil pro
    Inscrit en
    Juillet 2010
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2010
    Messages : 70
    Par défaut
    Salut

    je suis désolé pour de ne pas te repondre si vite; en fait j'ai rectifié ça et meme si ne fonctionne pas alors je voulais etre sur que la requete fonctionne sans les listes déroulantes (JCombobox) c'est pour ça j'ai les remplacé par des champs de saisi simple (JTextField) et j'ai testé sur l'interface de création d'une nouvelle intervention, alors eclipse me renvoie l'erreur suivante:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Point-virgule absent à la fin de l'instruction SQL.
    tout au debut je veux rééditer la requete qui me genère cette erreur comme ça je serai plus précis

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    int	resultat = requete.executeUpdate("insert into Interventioninter (DATE_ENTREE, DATE_INTERINT, DATE_FACTURATION, DATE_SORTIE, PROBLEMATIQUE, DESCRIPTION, COUT, MODE_PAIEMENT, INTSTATUT) values ('"+Denter.getText()+"', '"+Dateinter.getText()+"', '"+Dfacture.getText()+"', '"+Dsortie.getText()+"', '"+Pb.getText()+"', '"+Descrip.getText()+"', '"+Ct.getText()+"', '"+Mpay.getText()+"', '"+Stat.getText()+"') where N_CLIENT="+Rclient.Nmclient+" )");
    alors si tu regarde le code il ya bien le point virgule à la fin mais bon j'ai ajouté un point virgule en trois emplacement diffirent et meme ça pas marchait, je vais quand meme te montrer les exemples que j'ai fait comme tu sauras ce que j'ai fait.

    1 exemple

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    int	resultat = requete.executeUpdate("insert into Interventioninter (DATE_ENTREE, DATE_INTERINT, DATE_FACTURATION, DATE_SORTIE, PROBLEMATIQUE, DESCRIPTION, COUT, MODE_PAIEMENT, INTSTATUT) values ('"+Denter.getText()+"', '"+Dateinter.getText()+"', '"+Dfacture.getText()+"', '"+Dsortie.getText()+"', '"+Pb.getText()+"', '"+Descrip.getText()+"', '"+Ct.getText()+"', '"+Mpay.getText()+"', '"+Stat.getText()+"') where N_CLIENT="+Rclient.Nmclient+" );");

    2 exemple

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    int	resultat = requete.executeUpdate("insert into Interventioninter (DATE_ENTREE, DATE_INTERINT, DATE_FACTURATION, DATE_SORTIE, PROBLEMATIQUE, DESCRIPTION, COUT, MODE_PAIEMENT, INTSTATUT) values ('"+Denter.getText()+"', '"+Dateinter.getText()+"', '"+Dfacture.getText()+"', '"+Dsortie.getText()+"', '"+Pb.getText()+"', '"+Descrip.getText()+"', '"+Ct.getText()+"', '"+Mpay.getText()+"', '"+Stat.getText()+"') where N_CLIENT="+Rclient.Nmclient+" ; )");
    mais je veux attirer ton attention à une chose tres importante que dans l'interface ou j'ajoute des clients la meme requete INSERT et sans virgule fonctionne oui j'avoue que c'est bizarre quand meme je vais te mettre ci-dessous cette requete qui fonctionne.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    int	resultat = requete.executeUpdate("insert into Client (NOM, PRENOM, ADRESSE, N_TELFIXE, N_TELMOBILE, EMAIL) values ('"+Nomc.getText()+"', '"+Prec.getText()+"', '"+Adress.getText()+"', "+Ntel.getText()+", "+Ntelm.getText()+", '"+Email.getText()+"')");

    par contre pour la requete de modification le système me donne un message que la syntaxe n'est pas correcte alors moi je trouve pas une diffirence entre cette requete et l'autre de la modification des fiches client; je te la laisse aussi au cas ou si tu repere une erreur que j'ai pas reperé.


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     int	resultat = requete.executeUpdate("update Interventioninter set DATE_ENTREE='"+Denter.getText()+"', DATE_INTERINT='"+Dateinter.getText()+"', DATE_FACTURATION='"+Dfacture.getText()+"', DATE_SORTIE= '"+Dsortie.getText()+"', PROBLEMATIQUE='"+Pb.getText()+"', DESCRIPTION='"+Descrip.getText()+"', COUT='"+Ct.getText()+"', '"+Mpay.getText()+"', '"+Stat.getText()+"' from Interventioninter  where N_INTERINT  ="+Interventioninter.Nveninter+" ");



    Merci d'avance

  19. #19
    Membre Expert
    Avatar de slim_java
    Homme Profil pro
    Enseignant
    Inscrit en
    Septembre 2008
    Messages
    2 272
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2008
    Messages : 2 272
    Par défaut
    Citation Envoyé par patriot Voir le message
    par contre pour la requete de modification le système me donne un message que la syntaxe n'est pas correcte
    oui ta requête n'est pas correcte :

    la syntaxe doit être de la façon suivante :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    UPDATE nom_table_cible
    SET colonne = valeur [, colonne2 = valeur2 ...]
    [WHERE condition]
    or dans ta requéte tu fais :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    ......COUT='"+Ct.getText()+"', '"+Mpay.getText()+"', '"+Stat.getText()+"' from Interventioninter  where N_INTERINT  ="+Interventioninter.Nveninter+" ");
    regarde la fin de la requéte

  20. #20
    Membre confirmé
    Profil pro
    Inscrit en
    Juillet 2010
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2010
    Messages : 70
    Par défaut
    Salut

    oui tas raison désolé j'ai pas fait attention, bon quand j'ai modifié la requete la modification a été bien faite mais je recupére plus le resultat d'un Jliste pourtant le code de ma classe est le meme c'est pour ce la j'ai recrée la table Interventioninter et du coup je recupère bien la liste de ma requete mais la modification ne marche plus avec un message d'erreur
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Trop peu de paramètres. 1 attendu.
    je te laisse la requete que j'ai faite

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     int	resultat = requete.executeUpdate("update Interventioninter set DATE_ENTREE='"+Denter.getText()+"', DATE_INTERINT='"+Dateinter.getText()+"', DATE_FACTURATION='"+Dfacture.getText()+"', DATE_SORTIE= '"+Dsortie.getText()+"', PROBLEMATIQUE='"+Pb.getText()+"', DESCRIPTION='"+Descrip.getText()+"', COUT='"+Ct.getText()+"', MODE_PAIMENT= '"+Mpay.getText()+"', INTSTATUT= '"+Stat.getText()+"' WHERE N_INTERINT="+Interventioninter.Nveninter+"");

    pour la requete d'insertion j'ai toujour le message d'erreur comme quoi il ya un point virgule qui manque


    merci d'avance

Discussions similaires

  1. [MySQL] erreur lors de l'insertion d'une valeur obtenue par la fonction php mysql_insert_id() !
    Par mourad_betelgeuse dans le forum PHP & Base de données
    Réponses: 3
    Dernier message: 04/05/2013, 20h26
  2. Réponses: 6
    Dernier message: 22/01/2011, 01h42
  3. [vb.net] erreur lors de l'éxécution d'une classe
    Par os_rasta dans le forum VB.NET
    Réponses: 10
    Dernier message: 01/12/2005, 18h34
  4. Erreur lors de l'ajout d'une table
    Par FredMines dans le forum SQL Procédural
    Réponses: 1
    Dernier message: 27/07/2005, 13h13
  5. message d'erreur lors de la création d'une base
    Par franculo_caoulene dans le forum MS SQL Server
    Réponses: 4
    Dernier message: 16/04/2004, 15h47

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo