W
wapftgdss
Unregistered / Unconfirmed
GUEST, unregistred user!
小弟写了一个用户登陆程序,可运行时无论我输入正确的用户名密码还是输入错误的用户名密码程序都会提示用户名或密码错误,请问这是为什么?
我是先建立了一个Access数据库‘db1.mdb’,在里面新建了一个表,用来存放用户名和密码。
然后通过ADOConnection与它连接,Tpassword对应表‘mima’,连接成功了,编译也通过了
程序代码如下:
procedure TForm2.BitBtn1Click(Sender: TObject);
begin
if (dm.Tadopassword.FieldByName('name').Text<>edit1.Text) or
(dm.Tadopassword.FieldByName('key').Text<>edit2.Text) then
begin
n:=n-1;//n的值为3。。输入错一次减1;
Messagebox(handle,pchar('错误的用户名或密码,你还有'+inttostr
+'次机会!'),'警告!',MB_ICONWARNING);
if n=0 then application.terminate;
edit1.Clear;
edit2.Clear;
end
else
begin
form1.ShowModal;
form2.Visible:=false;
end
end;
我是先建立了一个Access数据库‘db1.mdb’,在里面新建了一个表,用来存放用户名和密码。
然后通过ADOConnection与它连接,Tpassword对应表‘mima’,连接成功了,编译也通过了
程序代码如下:
procedure TForm2.BitBtn1Click(Sender: TObject);
begin
if (dm.Tadopassword.FieldByName('name').Text<>edit1.Text) or
(dm.Tadopassword.FieldByName('key').Text<>edit2.Text) then
begin
n:=n-1;//n的值为3。。输入错一次减1;
Messagebox(handle,pchar('错误的用户名或密码,你还有'+inttostr
![Thumbs down (n) (n)](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f44e.png)
if n=0 then application.terminate;
edit1.Clear;
edit2.Clear;
end
else
begin
form1.ShowModal;
form2.Visible:=false;
end
end;