bonjour tous le monde,
j'ai crée un Jtable ou j'ai tapé des valeurs dans ses cellule, le problème que si je clique sur bouton envoyer il faut que je récupère le contenu de ces cellule et les enregistrer dans une table dans ma base de donnée.
*voici mon code pour insertion de données
cette méthode n'a rien ajouter dans ma table de plus j'ai fait
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 public void cretab(){ try{ String classe = comboc.getSelectedItem().toString(); String matiere = comboc.getSelectedItem().toString(); String cin = (this.table.getValueAt(this.row, 0).toString()); String nometud=this.table.getValueAt(this.row, 1).toString()+" "+this.table.getValueAt(this.row, 2).toString(); String Ds =(table.getValueAt(this.row,3).toString()); String Examen = (this.table.getValueAt(this.row, 4).toString()); Statement state=Connexion.getconnection().createStatement(); String query="INSERT INTO notes VALUES ('"+cin+"','"+classe+"','"+matiere+"',,'"+nometud+"''"+Ds+"','"+Examen+"');"; state.executeUpdate(query); this.update(getGraphics()); state.close(); } catch(Exception e){ } }
comme action de mon bouton envoyer...
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 if(arg0.getSource()==env){ JOptionPane jop = new JOptionPane(); int option = jop.showConfirmDialog(null, "Voulez-vous Confirmer l'envoie des données au Serveur ?", "Envoie", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if(option == JOptionPane.OK_OPTION) { cretab(); this.update(getGraphics()); }
Partager