if ADOQuery1.RecordCount = 0 then begin
Showmessage('账号或密码出错!');
I := 0;
end else beign
I := 1;
close;
end;
突然想到是不是这个问题。RecordCount返回的是SQL查询的记录数,
所以ADOQuery1.RecordCount < 0把这句改成 =0 。平时用惯了先>0做操作,不好意思
procedure TForm2.Button1Click(Sender: TObject);
begin
if (Trim(Edit1.Text)='账号')and(Trim(Edit2.Text)='密码') then
begin
I := 1;
close;
end
else
begin
showmessage('用户名或密码错误。');
I := 0;
end;
end;
单击取消按钮:
procedure TForm2.Button2Click(Sender: TObject);
begin
Application.Terminate;
end;
登陆窗口Onclose事件:
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if I=0 then
Application.Terminate;
end;