Bonjour à tous, voici le contexte, j'ai une combo reliée correctement a ma base qui affiche tout les moyens de paiement disponibles, a coté j'ai un jtextfield ou l'utilisateur peu saisir un nouveau mode de paiement et le bouton ajouter permet de l'inserer dans la base, au niveau de la combo pas de probleme les données sont bien importées de la base mais quand je rempli le textfield et que je clique sur ajouter je vois cette erreur la :"connexion impossible: Can not issus data manipulation statements with executeQuery().", et je ne comprend vraiment pas pourquoi la connection est impossible vu que cela marche avec la combo, voici le code de ma page :
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
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
 
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
public class paiement_famclients {
 
	private JFrame jFrame_paiement_famclients = null;  //  @jve:decl-index=0:visual-constraint="435,54"
	private JPanel jContentPane = null;
	private JPanel jPanel_paiement_famclients = null;
	private JLabel jLabel_code_paiement_famclients = null;
	private JLabel jLabel_designation_paiement_famclients = null;
	private JTextField jTextField_code_paiement_famclients = null;
	private JTextField jTextField_designation_paiement_famclients = null;
	private JButton jButton_ajouter_paiement_famclients = null;
	private JButton jButton_suppr_paiement_famclients = null;
	private JComboBox jComboBox_mdp_client = null;
	private JButton jButton_ajouter_famclients = null;
 
	/**
         * This method initializes jFrame_paiement_famclients   
         *      
         * @return javax.swing.JFrame   
         */
	public JFrame getJFrame_paiement_famclients() {
		if (jFrame_paiement_famclients == null) {
			jFrame_paiement_famclients = new JFrame();
			jFrame_paiement_famclients.setSize(new Dimension(252, 237));
			jFrame_paiement_famclients.setTitle("Moyens de paiement");
			jFrame_paiement_famclients.setLocation(new Point(300, 290));
 
			jFrame_paiement_famclients.setContentPane(getJContentPane());
			jFrame_paiement_famclients.setVisible(true);
		}
		return jFrame_paiement_famclients;
	}
 
	/**
         * This method initializes jContentPane 
         *      
         * @return javax.swing.JPanel   
         */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(getJPanel_paiement_famclients(), null);
		}
		return jContentPane;
	}
 
	/**
         * This method initializes jPanel_paiement_famclients   
         *      
         * @return javax.swing.JPanel   
         */
	private JPanel getJPanel_paiement_famclients() {
		if (jPanel_paiement_famclients == null) {
			jLabel_designation_paiement_famclients = new JLabel();
			jLabel_designation_paiement_famclients.setBounds(new Rectangle(9, 40, 71, 26));
			jLabel_designation_paiement_famclients.setHorizontalAlignment(SwingConstants.CENTER);
			jLabel_designation_paiement_famclients.setText("Désignation");
			jLabel_code_paiement_famclients = new JLabel();
			jLabel_code_paiement_famclients.setBounds(new Rectangle(9, 10, 71, 26));
			jLabel_code_paiement_famclients.setHorizontalAlignment(SwingConstants.CENTER);
			jLabel_code_paiement_famclients.setText("Code");
			jPanel_paiement_famclients = new JPanel();
			jPanel_paiement_famclients.setLayout(null);
			jPanel_paiement_famclients.setBounds(new Rectangle(-1, 0, 245, 201));
			jPanel_paiement_famclients.add(jLabel_code_paiement_famclients, null);
			jPanel_paiement_famclients.add(jLabel_designation_paiement_famclients, null);
			jPanel_paiement_famclients.add(getJTextField_code_paiement_famclients(), null);
			jPanel_paiement_famclients.add(getJTextField_designation_paiement_famclients(), null);
 
			jPanel_paiement_famclients.add(getJButton_suppr_paiement_famclients(), null);
			jPanel_paiement_famclients.add(getJComboBox_mdp_client(), null);
			jPanel_paiement_famclients.add(getJButton_ajouter_famclients(), null);
		}
		{
			Statement instruction = null;
			Connection connexion = null;
			ResultSet resultat = null;
			try
			{
				Class.forName("com.mysql.jdbc.Driver");
 
				connexion = DriverManager.getConnection("jdbc:mysql://localhost/gescom2","root","");
				instruction = connexion.createStatement();
 
				resultat = instruction.executeQuery("SELECT lib_mdp FROM mode_de_paiement" );
 
 
				while(resultat.next())
				{
					jComboBox_mdp_client.addItem((resultat.getString("lib_mdp")));
				}
 
 
 
 
 
 
 
			}
			catch (ClassNotFoundException ex)
			{
				JOptionPane.showMessageDialog(null,"Classe introuvable" + ex.getMessage());
			}
			catch (SQLException ex)
			{
				JOptionPane.showMessageDialog(null, "Connexion impossible:" +ex.getMessage());
			}
			finally
			{
				try
				{
 
					if(connexion !=null)
						connexion.close();
					if(instruction !=null)
						instruction.close();
					if (connexion !=null)
						connexion.close();
				}
				catch (SQLException ex)
				{
					ex.printStackTrace();
				}
			}
	}
 
		return jPanel_paiement_famclients;
	}
 
	/**
         * This method initializes jTextField_code_paiement_famclients  
         *      
         * @return javax.swing.JTextField       
         */
	private JTextField getJTextField_code_paiement_famclients() {
		if (jTextField_code_paiement_famclients == null) {
			jTextField_code_paiement_famclients = new JTextField();
			jTextField_code_paiement_famclients.setBounds(new Rectangle(89, 11, 153, 24));
			jTextField_code_paiement_famclients.getText();
 
		}
		return jTextField_code_paiement_famclients;
	}
 
	/**
         * This method initializes jTextField_designation_paiement_famclients   
         *      
         * @return javax.swing.JTextField       
         */
	private JTextField getJTextField_designation_paiement_famclients() {
		if (jTextField_designation_paiement_famclients == null) {
			jTextField_designation_paiement_famclients = new JTextField();
			jTextField_designation_paiement_famclients.setBounds(new Rectangle(89, 41, 153, 24));
			jTextField_designation_paiement_famclients.getText();
		}
		return jTextField_designation_paiement_famclients;
	}
 
	/**
         * This method initializes jButton_ajouter_paiement_famclients  
         *      
         * @return javax.swing.JButton  
         */
 
	/**
         * This method initializes jButton_suppr_paiement_famclients    
         *      
         * @return javax.swing.JButton  
         */
	private JButton getJButton_suppr_paiement_famclients() {
		if (jButton_suppr_paiement_famclients == null) {
			jButton_suppr_paiement_famclients = new JButton();
			jButton_suppr_paiement_famclients.setBounds(new Rectangle(148, 109, 94, 21));
			jButton_suppr_paiement_famclients.setText("Supprimer");
		}
		return jButton_suppr_paiement_famclients;
	}
 
	/**
         * This method initializes jComboBox_mdp_client 
         *      
         * @return javax.swing.JComboBox        
         */
	private JComboBox getJComboBox_mdp_client() {
		if (jComboBox_mdp_client == null) {
			jComboBox_mdp_client = new JComboBox();
			jComboBox_mdp_client.setBounds(new Rectangle(14, 80, 123, 23));
			jComboBox_mdp_client.setEditable(true);
		}
		return jComboBox_mdp_client;
	}
 
	/**
         * This method initializes jButton_ajouter_famclients   
         *      
         * @return javax.swing.JButton  
         */
	private JButton getJButton_ajouter_famclients() {
		if (jButton_ajouter_famclients == null) {
			jButton_ajouter_famclients = new JButton();
			jButton_ajouter_famclients.setBounds(new Rectangle(148, 80, 92, 24));
			jButton_ajouter_famclients.setText("Ajouter");
			jButton_ajouter_famclients.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent e){
			{
				Statement instruction = null;
				Connection connexion = null;
				ResultSet resultat = null;
				try
				{
					Class.forName("com.mysql.jdbc.Driver");
 
					connexion = DriverManager.getConnection("jdbc:mysql://localhost/gescom2","root","");
					instruction = connexion.createStatement();
 
					resultat = instruction.executeQuery("INSERT INTO mode_de_paiement (code_mdp) VALUES"+jTextField_code_paiement_famclients.getText());
 
 
 
 
 
				}
				catch (ClassNotFoundException ex)
				{
					JOptionPane.showMessageDialog(null,"Classe introuvable" + ex.getMessage());
				}
				catch (SQLException ex)
				{
					JOptionPane.showMessageDialog(null, "Connexion impossible:" +ex.getMessage());
				}
				finally
				{
					try
					{
 
						if(connexion !=null)
							connexion.close();
						if(instruction !=null)
							instruction.close();
						if (connexion !=null)
							connexion.close();
					}
					catch (SQLException ex)
					{
						ex.printStackTrace();
					}
				}
		}
			}
			});
		}
 
 
		return jButton_ajouter_famclients;
	}
 
}
merci d'avance pour vos réponses