- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi FDQuery 验证登录
procedure TForm1.BtnLoginClick(Sender: TObject);
begin
With FDQueryUser do
try
Connection := FDConnecMain;
Close;
SQL.Clear;
SQL.Add('Select * From USERS Where USERNAME=:NAME and USERPASS =: PSS');
ParamByName('NAME').AsString := EditUser.Text;
ParamByName('PSS').AsString := EditPassword.Text;
Prepared := True;
Open;
if Not IsEmpty then
begin
//登录成功
UName := FieldByName('USERNAME').AsString;
UPas := FieldByName('USERPASS').AsString;
UYetki := FieldByName('YETKI').AsString;
Form2.ShowModal;
end
else
begin
TextM.Caption := '登录失败!';
end;
finally
FDQueryUser.Close;
end;
end;