procedure TfrmLogin.btnCancelClick(Sender: TObject);
begin
Application.Terminate; //结束程序
end;
procedure TfrmLogin.btnLoginClick(Sender: TObject);
begin
rightpwd := False;
with Dm1.tblLoginUser do
begin
if not Active then
open;
First;
while not eof do
begin
if Trim(FieldByName('mc').AsString) = edtUser.Text then
begin
if Trim(FieldByName('pwd').AsString) = edtPwd.Text then
begin
rightpwd := True; //设置成功登录标志为真
Break;
end
else
begin
MessageBox(0, '对不起,密码不正确!请重新输入。', '提示', MB_OK +
MB_ICONWARNING);
edtpwd.setfocus;
exit;
end;
end
else
next;
end;
if not rightpwd then
begin
MessageBox(0, '对不起,该用户不存在!请重新输入。', '提示', MB_OK +
MB_ICONWARNING);
edtuser.SetFocus;
exit;
end
end;
close;
frmMain.LoginUserName := edtUser.text;
&n