Bonsoir, il est 21h chez moi; je suissur un logiciel que je developpe en java avec netbeans pour ma daronne
; le problème c'est que j'éssaie de parcourir un tableau et de recuperer des valeurs pour ensuite effectuer des mises à jour dans la bdd. et je crois que ce morceau de code pose problème. La table s'appelle facture. Coordialement
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 int i = facture.getColumnCount(); for (int j = 0; j < i; j++) { int quantite_acheter = Integer.parseInt(facture.getValueAt(facture.getSelectedRow(),0).toString()); String nom = facture.getValueAt(facture.getSelectedRow(), 1).toString(); String marque = facture.getValueAt(facture.getSelectedRow(), 2).toString(); String taille= facture.getValueAt(facture.getSelectedRow(), 3).toString(); String upd = "select * from articles where nom='"+nom+"'taille = '"+taille+"' marque ='"+marque+"' "; try { rq.connexion(); ResultSet res = rq.executer(upd); int id =res.getInt("id"); int quantite_actu =res.getInt("stock"); int new_stock = quantite_actu - quantite_acheter; String enf = "update article set stock ='"+new_stock+"' where id ='"+id+"'"; rq.modifier(enf); } catch (SQLException e) { JOptionPane.showMessageDialog(null, ""); } }
Partager