Simple Code Button Login on Delphi

This my code simple to checking login using query and place on login button, here we go..

Procedure TfrmLogin.cxbtn5Click(Sender: TObject);
begin
if (edt1.Text = '') or (edt2.Text = '') then
  Application.MessageBox('Username and password must insert', 'INFORMASI', mb_OK);

with dm.que_glob do
 begin
   Close;
   SQL.Clear;
   SQL.Add('SELECT * FROM mdata_user WHERE user ='+QuotedStr(edt1.Text));
   Open;
 end;

 if dm.que_glob.RecordCount = 0 then
   Application.MessageBox('Username unrecordable', 'INFORMASI', mb_OK)
 else
   begin
     if dm.que_glob.FieldByName('pass').AsString <> edt2.Text then
       Application.MessageBox('wrong Password, Please try again', 'INFORMASI', mb_OK)
     else
        ShowMessage('Bravo');
   end;
end;

0 Response to "Simple Code Button Login on Delphi"

Post a Comment