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
| String[]entete= {"Description","CARINE","JEAN","NAOMIE","PATRICK"};
Object [][]donnees= {{"5000",0,0,0,0,},
{"3000",0,0,0,0},
{"1500",0,0,0,0},
{"800",0,0,0,0},
{"600",0,0,0,0},
{"500",0,0,0,0},
{"400",0,0,0,0}};
PreparedStatement pstmt=connexion.prepareStatement("INSERT INTO QREVENDEUR(Date,QUANTITES) VALUES('" + ((JTextField)daterev.getDateEditor().getUiComponent()).getText() + "',?)");
for (int i = 1; i < model.getRowCount(); i++) {
for (int j = 1; j < model.getColumnCount(); j++) {
int o = ((Integer) model.getValueAt(i, j));
// pstmt.setInt(i+0, (int)o);
pstmt.setInt(i, (int)o);
//pstmt.setDate(1, (JTextField)daterev.getDateEditor().getUiComponent()).getText())(1,daterev.getDate());
}
}
pstmt.executeUpdate();
pstmt.clearParameters();
pstmt.close();
JOptionPane.showMessageDialog(null,"Inséré");
}catch (Exception insertException) |
Partager