1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| With Table1 do
begin
try
Open;
if Locate('Matricule_Employé',DBEdit.Text,[]) Then
begin
// Tu peux ici aussi gérer un Edit; le locate te permet d'être positionné dessus
messagedlg('Ce numéro est déjà attribué,veuillez introduire un autre numéro',mtinformation,[mbok],0);
end
else
begin
Insert; //ou Append;
fieldbyname('Matricule_Employé').asstring:=DBEdit1.text;
fieldbyname('Nom_Employé').asstring:=edit2.text;
fieldbyname('Prenom_Employé').asstring:=edit3.text;
fieldbyname('Adresse_Employé').asstring:=edit4.text;
fieldbyname('Telephone_Employé').asstring:=(MaskEdit1.text);
fieldbyname('Fonction_Employé').asstring:=edit5.text;
post;
end;
finally
Close;
end;
end; {End With} |
Partager