这是一个登录界面的代码,当我运行是会报错: Invalid use of keyword
Token:where
Line Number:1
procedure TForm1.suiButton1Click(Sender: TObject);
var db:string;
begin
db:=extractfilepath(application.ExeName);
query1.DatabaseName:=db;
query1.Close;
query1.Params.Clear;
query1.SQL.Clear;
if suicombobox1.Text='操作员' then
query1.SQL.Add('select * from worker')
else
if suicombobox1.Text='操作员' then
query1.SQL.Add('select * from manager');
query1.SQL.Add('where 工号=:num and 密码=:psw');
query1.ParamByName('num').AsString:=suiedit1.text;
query1.ParamByName('psw').AsString:=suiedit2.text;
query1.Open;
if times<3 then
if query1.RecordCount=0 then
begin
suimessagedialog1.ShowModal;
times:=times+1;
suiedit1.SetFocus;
end
else
if suicombobox1.Text='操作员' then
begin
form1.Visible:=false;
form2.showmodal;
form2.FreeOnRelease;
form1.Visible:=true;
suiedit1.Text:='';
suiedit2.Text:='';
suiedit1.SetFocus;
end
else
if suicombobox1.Text='管理员' then
begin
form1.Visible:=false;
form3.showmodal;
form3.FreeOnRelease;
form1.Visible:=true;
suiedit1.Text:='';
suiedit2.Text:='';
suiedit1.SetFocus;
end
else
begin
suimessagedialog3.showmodal;
end
else
begin
suimessagedialog2.showmodal;
application.Terminate;
end;
end;
Token:where
Line Number:1
procedure TForm1.suiButton1Click(Sender: TObject);
var db:string;
begin
db:=extractfilepath(application.ExeName);
query1.DatabaseName:=db;
query1.Close;
query1.Params.Clear;
query1.SQL.Clear;
if suicombobox1.Text='操作员' then
query1.SQL.Add('select * from worker')
else
if suicombobox1.Text='操作员' then
query1.SQL.Add('select * from manager');
query1.SQL.Add('where 工号=:num and 密码=:psw');
query1.ParamByName('num').AsString:=suiedit1.text;
query1.ParamByName('psw').AsString:=suiedit2.text;
query1.Open;
if times<3 then
if query1.RecordCount=0 then
begin
suimessagedialog1.ShowModal;
times:=times+1;
suiedit1.SetFocus;
end
else
if suicombobox1.Text='操作员' then
begin
form1.Visible:=false;
form2.showmodal;
form2.FreeOnRelease;
form1.Visible:=true;
suiedit1.Text:='';
suiedit2.Text:='';
suiedit1.SetFocus;
end
else
if suicombobox1.Text='管理员' then
begin
form1.Visible:=false;
form3.showmodal;
form3.FreeOnRelease;
form1.Visible:=true;
suiedit1.Text:='';
suiedit2.Text:='';
suiedit1.SetFocus;
end
else
begin
suimessagedialog3.showmodal;
end
else
begin
suimessagedialog2.showmodal;
application.Terminate;
end;
end;
if suicombobox1.Text='操作员' then
query1.SQL.Add('select * from worker')
else
if suicombobox1.Text='操作员' then //是不是应该为'管理员' ?如果为管理员时,没有SELECT语句
query1.SQL.Add('select * from manager');你这儿判断不严谨,难道只有上面2种人员角色?