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 41 42 43 44 45 46 47 48
| if(cree=true) then
begin
with SqlQuery1 do
begin
Close;
with Sql do
begin
Clear;
Add('update commande');
add('set designation='' '+edit2.text+' '' ');
add(',nom_dir ='' '+ComboBox1.Text+' '' ');
add(',type ='' '+Combobox2.Text+' ''');
if edit3.Text='' then add(',dates=NULL ')
else add(',dates='' '+edit3.Text+' '' ');
add(',etat='+inttostr(a));
add(',annee='+annee.ComboBox1.Text);
add('set nombre_lot='+inttostr(nbrlot));
add('where numero='' '+edit1.Text+' '' and annee='+annee.ComboBox1.Text);
end;//with sql
execsql;
cree:=false;
end;//with sqlquery1
end //if cree=true
else
begin
with SqlQuery1 do
begin
Close;
with Sql do
begin
Clear;
Add('INSERT INTO commande(numero,designation,dates,type,etat,nom_dir,montant,quantite,annee,nombre_lot');
Add('VALUES ('''+edit1.Text+'''');
add(','' '+edit2.text+' '' ');
if edit3.Text='' then add(',dates=NULL ')
else add(','' '+edit3.Text+' '' ');
add(','' '+Combobox2.Text+' ''');
add(','+inttostr(a));
add(','' '+ComboBox1.Text+' '' ');
add(','+edit10.Text);
add(','+edit11.Text);
add(','+annee.ComboBox1.Text);
add(','+inttostr(nbrlot)+')');
end; //with sql
execsql;
end; //with sqlquery1
end; //if cree=false |
Partager