procedure TForm1.FormCreate(Sender: TObject);
begin
self.Caption :=application.Title + ' - ';
self.Caption :=self.Caption +'用户登录';
I_logo:=0;
with table1 do
begin
close;
DatabaseName:='DBDEMOS';
TableName :='D:\Program Files\Common Files\Borland Shared\Database Desktop\WorkDir\user.db';
open;
end;
table1.First;
end;procedure TForm1.Button2Click(Sender: TObject);
begin
application.Terminate ;
end;procedure TForm1.Button1Click(Sender: TObject);
var
username,password:string;begin
username:=edit1.Text ;
password:=edit2.Text ; with table1 do
begin while not table1.eof do //检查用户名与密码
begin if(username=table1.FieldByName('username').AsString) and (password=table1.FieldByName('password').AsString) then
begin
messagedlg('您的密码正确,你是合法的用户!',mtInformation,[mbok],0);
table1.first;
break;
end;
table1.Next ;
end; //end while
if table1.eof then
begin
inc(I_logo);
if I_logo>=3 then
begin
//messagedlg('您已尝试超过 3 次,系统将停止运行!',mterror,[mbok],0);
table1.Close ;
table1.Free;
//close;
application.Terminate ;
exit;
end
else
begin
messagedlg('用户名与密码不符,请检查后重新输入。'+#13+#13
+'你还有 '+inttostr(3-I_logo)+' 次机会!',mterror,[mbok],0);
edit1.SetFocus ;
edit1.Text :='';
edit2.Text :='';
exit;
end;
end;
end;
table1.close;
table1.Free;end;procedure TForm1.Edit2KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=13 then button1.onclick(self);
if key=27 then button2.onclick(self);
end;end.
老是出错大家看一下,出错地方就是while not table1.eof do //检查用户名与密码
这个地方,不知道什么地方搞错啦!!谢谢大家!!
begin
self.Caption :=application.Title + ' - ';
self.Caption :=self.Caption +'用户登录';
I_logo:=0;
with table1 do
begin
close;
DatabaseName:='DBDEMOS';
TableName :='D:\Program Files\Common Files\Borland Shared\Database Desktop\WorkDir\user.db';
open;
end;
table1.First;
end;procedure TForm1.Button2Click(Sender: TObject);
begin
application.Terminate ;
end;procedure TForm1.Button1Click(Sender: TObject);
var
username,password:string;begin
username:=edit1.Text ;
password:=edit2.Text ; with table1 do
begin while not table1.eof do //检查用户名与密码
begin if(username=table1.FieldByName('username').AsString) and (password=table1.FieldByName('password').AsString) then
begin
messagedlg('您的密码正确,你是合法的用户!',mtInformation,[mbok],0);
table1.first;
break;
end;
table1.Next ;
end; //end while
if table1.eof then
begin
inc(I_logo);
if I_logo>=3 then
begin
//messagedlg('您已尝试超过 3 次,系统将停止运行!',mterror,[mbok],0);
table1.Close ;
table1.Free;
//close;
application.Terminate ;
exit;
end
else
begin
messagedlg('用户名与密码不符,请检查后重新输入。'+#13+#13
+'你还有 '+inttostr(3-I_logo)+' 次机会!',mterror,[mbok],0);
edit1.SetFocus ;
edit1.Text :='';
edit2.Text :='';
exit;
end;
end;
end;
table1.close;
table1.Free;end;procedure TForm1.Edit2KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=13 then button1.onclick(self);
if key=27 then button2.onclick(self);
end;end.
老是出错大家看一下,出错地方就是while not table1.eof do //检查用户名与密码
这个地方,不知道什么地方搞错啦!!谢谢大家!!
解决方案 »
- 工资自定义公式模块的实现
- 谁那里有《Oracle Database 10g完全参考手册》中文版的电子书啊?发给我好吗
- 动态释放ODAC组件时 invalid pointer operation
- 以前编译运行没有问题,不知道怎的现在总提示运行时class TstringField not found?
- SOS
- 一个关于ReportMachine的问题,顶者有分!
- 运行线程时出现Thread Error:句柄无效 错误,请教
- delphi中TCHART的MARKS的LABELS的重叠问题(PIESERIES)
- 大家一起吧,我们一起来开软件公司
- 可能是内存问题
- 急求installShield Express 下载地址!
- 一个简单的问题。如何提取需要的字符?在线等待。
设置 loginprompt=false
begin while not table1.eof do //检查用户名与密码
begin还有请把Delphi的错误信息也贴出来吧。
Table1.First )
试一试看!
while not table1.eof do //检查用户名与密码
begin