这是一个登陆模块的代码,可是不管我输入的用户名和密码是什么它都提示输入的用户名或者密码错误,这是为什么啊?(我用在其他工程里正常,可是我把它用在另外一个工程里就是这样了)
procedure TCheckUserForm.BitBtn1Click(Sender: TObject);
var
table1:TTable;
begin
table1:=TTable.Create(self);
Table1.DatabaseName:='rsgl';
Table1.TableName:='operator.db';
Table1.Open;
Table1.SetKey;
table1.FieldByName('name').asstring:=edit1.text;
if (Table1.GoTokey) and (Table1.FieldByName('password').AsString=edit2.text) then
begin
username:=edit1.text;
password:=edit2.text;
qx1:=Table1.fieldByName('right_1').asboolean;
qx2:=Table1.fieldByName('right_2').asboolean;
qx3:=Table1.fieldByName('right_3').asboolean;
Table1.Close;
close;
end
else
begin
Table1.Close;
Application.MessageBox('用户名或密码输入错误,请检查再重试!','提示信息',mb_ok);
edit1.text:='';
edit2.Text:='';
edit1.SetFocus;
i:=i-1;
if i=0 then
close;
end
end;
procedure TCheckUserForm.BitBtn1Click(Sender: TObject);
var
table1:TTable;
begin
table1:=TTable.Create(self);
Table1.DatabaseName:='rsgl';
Table1.TableName:='operator.db';
Table1.Open;
Table1.SetKey;
table1.FieldByName('name').asstring:=edit1.text;
if (Table1.GoTokey) and (Table1.FieldByName('password').AsString=edit2.text) then
begin
username:=edit1.text;
password:=edit2.text;
qx1:=Table1.fieldByName('right_1').asboolean;
qx2:=Table1.fieldByName('right_2').asboolean;
qx3:=Table1.fieldByName('right_3').asboolean;
Table1.Close;
close;
end
else
begin
Table1.Close;
Application.MessageBox('用户名或密码输入错误,请检查再重试!','提示信息',mb_ok);
edit1.text:='';
edit2.Text:='';
edit1.SetFocus;
i:=i-1;
if i=0 then
close;
end
end;