做了一个界面不能运行代码出现错误啦...........
前台是两个字段用户名(EmployeeName),密码(Passwd):char
在确定的ONCLICK那里写代码
如下:
procedure TForm2.SpeedButton1Click(Sender: TObject);
begin
if (Edit1.Text <>'') and (Edit2.Text <>'') then
begin
with ADOQuery1 do
begin
Close;
SQL.Clear;
SQL.Add('select *from EmployeeInfo where EmployeeName:=Edit1.Text and Passwd:=Edit1.Text');
//Parameters.FieldByName('employname').AsString :=Edit1.Text;
//parameters.FieldByName('password').AsString :=Edit2.Text;
Open;
if Eof then
begin
logTime := logTime+1;
if messagebox(handle,'您填写的用户名或密码不正确,是否重新输入!','出错提示',
Mb_IconInformation+Mb_Okcancel) = idcancel then
Application.Terminate;
if logTime >2 then
begin
messagebox(handle,'对不起,登录次数超过三次程序自动关闭!','非法登录',
Mb_Iconwarning+Mb_Ok);
Application.Terminate;
end;
end
else
begin
case FieldByName('LevelId').AsInteger of
0:begin
mainform.N16.Enabled:=false;
MAINFORM.N21.Enabled:=false;
end;
1:begin
MAINFORM.N9.Enabled:=false;
MAINFORM.N10.Enabled:=false;
end;
2:begin
MAINFORM.N6.Enabled:=false;
MAINFORM.N16.Enabled:=false;
MAINFORM.N7.Enabled:=false;
end;
end;
END;
END;END;END;
END.
运行会一时出错啊@!!
好像下面就是问题的错误所在:
SQL.Add('select *from EmployeeInfo where EmployeeName:=Edit1.Text and Passwd:=Edit1.Text');
//Parameters.FieldByName('employname').AsString :=Edit1.Text;
//parameters.FieldByName('password').AsString :=Edit2.Text;
Open;