主题:求高手找错误
unit LoginUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, jpeg, ExtCtrls, DB, DBTables;
type
TLoginForm = class(TForm)
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
BitBtn1: TBitBtn;
Table1UserName: TTable;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
LoginForm: TLoginForm;
implementation
uses mainUnit;
var times: integer;
{$R *.dfm}
procedure TLoginForm.BitBtn1Click(Sender: TObject);
begin
table1.SetKey; ??????报错的地方
Table1UserName.Value:=edit1.Text;
if (table1.GotoKey) and (table1password.Value=edit2.Text) then
begin
if (table1usertype.Value='admin') then
begin
mainform.show;
loginform.Release;
end
else
begin
mainform.show;
loginform.Release;
mainform.n6.visible:=false; //数据维护菜单不可见
mainform.n11.visible:=false; //添加用户菜单不可见
end;
end
else
begin
times:=times+1;
if times<=2 then
begin
showmessage('请重新输入用户名和密码!');
edit1.Clear;
edit2.Clear;
edit1.SetFocus;
end
else
begin
showmessage('你是非法用户!程序就要中止!!');
application.Terminate;
end;
end;
end;
end.
[Error] LoginUnit.pas(38): Undeclared identifier: 'table1'
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, jpeg, ExtCtrls, DB, DBTables;
type
TLoginForm = class(TForm)
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
BitBtn1: TBitBtn;
Table1UserName: TTable;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
LoginForm: TLoginForm;
implementation
uses mainUnit;
var times: integer;
{$R *.dfm}
procedure TLoginForm.BitBtn1Click(Sender: TObject);
begin
table1.SetKey; ??????报错的地方
Table1UserName.Value:=edit1.Text;
if (table1.GotoKey) and (table1password.Value=edit2.Text) then
begin
if (table1usertype.Value='admin') then
begin
mainform.show;
loginform.Release;
end
else
begin
mainform.show;
loginform.Release;
mainform.n6.visible:=false; //数据维护菜单不可见
mainform.n11.visible:=false; //添加用户菜单不可见
end;
end
else
begin
times:=times+1;
if times<=2 then
begin
showmessage('请重新输入用户名和密码!');
edit1.Clear;
edit2.Clear;
edit1.SetFocus;
end
else
begin
showmessage('你是非法用户!程序就要中止!!');
application.Terminate;
end;
end;
end;
end.
[Error] LoginUnit.pas(38): Undeclared identifier: 'table1'