-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreationCommande.java
More file actions
21 lines (18 loc) · 920 Bytes
/
CreationCommande.java
File metadata and controls
21 lines (18 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
GregorianCalendar gregC = commande.getDateCommande();
java.sql.Date sqlD = new java.sql.Date(gregC.getTimeInMillis());
String instructionSQL ="INSERT INTO Commande VALUES (?, "+sqlD+", ?, ?, ?)";
PreparedStatement prepStat = connexion.preparedStatement(instructionSQL);
prepStat.setInt(1,commande.getNumero());
prepStat.setString(2,commande.getUtilisateur());
prepStat.setString(3,commande.getFournisseur());
prepStat.setString(4,commande.getEtat());
prepStat.executeUpdate();
for (i=0; i<allLignesProduits.size(); i++){
LigneProduit ligneProduit = new LigneProduit (allLignesProduits.get(i));
String instructionSQL = "INSERT INTO LigneProduit VALUES (?, ?, ?)";
PreparedStatement prepStat = connexion.preparedStatement(instructionSQL);
prepStat.setInt(1,ligneProduit.getProduit());
prepStat.setInt(2,ligneProduit.getCommandeFourn());
prepStat.setInt(3,ligneProduit.Quantite());
prepStat.executeUpdate();
}