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
|
String num_bl = nbl.getText();
String ref_prod = nump.getText();
String codebare = barecode.getText();
String designation = nomp.getText();
String designation_fr = nomp_fr.getText();
String categorie = catp.getSelectedItem().toString();
String unite_p = unitep.getSelectedItem().toString();
String quantite_T = qteT.getText();
String prix_unitaire = prixp.getText();
SimpleDateFormat date= new SimpleDateFormat("yyyy-MM-dd");
Date ddate =datexp.getDate();
String date_exp = date.format(ddate);
String alerte_q = alerteq.getText();
String alerte_d = alerted.getText();
String requete = "insert into produit(num_bl,ref_prod,codebare,designation,designation_fr,categorie,unite_p,date_exp,quantite_T,prix_unitaire,alerte_q,alerte_d)VALUES('" + num_bl + "','"
+ ref_prod + "','" + codebare + "','" + designation + "', '" + designation_fr + "','" + categorie + "','" + unite_p + "' ,'" + date_exp + "','" + quantite_T + "','" + prix_unitaire + "','" + alerte_q + "','" + alerte_d + "')";
try {
st.executeUpdate(requete);
JOptionPane.showMessageDialog(null, "le produit est ajouté");
nbl.setText("");
nump.setText("");
barecode.setText("");
nomp.setText("");
nomp_fr.setText("");
catp.setSelectedItem(2);
unitep.setSelectedItem(2);
qteT.setText("");
prixp.setText("");
datexp.setDate(ddate);
alerteq.setText("");
alerted.setText("");
afficher();
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex.getMessage());
} |
Partager