1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| procedure ValiderOnClick(Sender : TObject);
function CheckUser : Boolean
var AQuery : TQuery
begin
AQuery:=TQuery.Create(nil);
try
AQuery.Connexion:=Database1; // à modifier en fonction du type de composant
AQuery.SQL.Text:='SELECT USER_NAME,MOTDEPASSE FROM USERS WHERE USER_NAME=:U AND MOTDEPASSE=:MDP';
AQuery.ParamByName('U').asString:=Edit1.Text; // à modifier en fonction du type de composant
AQuery.ParamByName('MDP').asString:=Edit2.Text; // à modifier en fonction du type de composant
AQuery.Active:=True;
result:=not AQuery.FieldByName('USER_NAME').isNull; // @retwas pas besoin du count ;)
AQuery.Close;
finally
AQuery.Free;
end;
end;
begin
if not CheckUser then showmessage('mot de passe incorrect')
else Form2.show;
end; |