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
|
var
ID: Integer;
Nom: string;
DateNais: TDateTime;
begin
ID := 10; // A compléter
if not TryStrToDate(EditDate.Text, DateNais) then
begin
ShowMessage('La date entrée est incorrecte !');
Exit;
end;
Nom := EditNom.Text;
if (Nom < 'djerdjar') or (Nom > 'laaribi') then
begin
ShowMessage('Nom incorrect !');
Exit;
end;
with Form1.ADOQuery1 do
begin
Close;
SQL.Clear;
SQL.Add('INSERT INTO MA_TABLE (ID, NOM, DATE_NAIS)');
SQL.Add('VALUES( :ID, :NOM, :DATE_NAIS)');
Parameters.ParamByName('ID').Value := ID;
Parameters.ParamByName('NOM').Value := Nom;
Parameters.ParamByName('DATE_NAIS').Value := DateNais;
try
ExecSQL;
except
ShowMessage('Echec lors de l''insertion des données !');
end;
end;
end; |
Partager