分为老师、管理员和学生不同的登录权限,运行提示raised exception class EOleException with message '关键字'user'附近有语法错误。‘
但是检查了几遍,没发现什么语法错误呀,而且编译也通过了
procedure TForm1.Button2Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
username,apassword:String;
errcount:Integer;
begin
errcount:=0;
username := Edit1.Text;
apassword := Edit2.Text;
ADOQuery1.close;
ADOQuery1.SQL.Clear;
while(errcount<3) do
begin
ADOQuery1.SQL.Text:='select * from user where userno='''+username+''' and password='''+apassword+'''';
ADOQuery1.open;
if ADOQuery1.RecordCount=0 then
begin
errcount:=errcount+1;
showMessage('用户名或密码错误,请重新输入');
Edit1.Clear;
edit2.Clear;
end
else
begin
ADOQuery1.SQL.Text:='select * from student where sno='''+username+'''';
ADOQuery1.open;
if ADOQuery1.RecordCount=0 then
begin
ADOQuery1.SQL.Text:='select * from teacher where tno='''+username+'''';
ADOQuery1.open;
if ADOQuery1.RecordCount=0 then
begin
Form5.Show;
Form1.close;
end
else
begin
Form4.show;
Form1.Close;
end;
end
else
begin
Form3.Show;
Form1.Close;
end;
end;
end;
if errcount=3 then
begin
showMessage('连续三次密码错误,系统退出!');
application.Terminate;
end;end;
但是检查了几遍,没发现什么语法错误呀,而且编译也通过了
procedure TForm1.Button2Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
username,apassword:String;
errcount:Integer;
begin
errcount:=0;
username := Edit1.Text;
apassword := Edit2.Text;
ADOQuery1.close;
ADOQuery1.SQL.Clear;
while(errcount<3) do
begin
ADOQuery1.SQL.Text:='select * from user where userno='''+username+''' and password='''+apassword+'''';
ADOQuery1.open;
if ADOQuery1.RecordCount=0 then
begin
errcount:=errcount+1;
showMessage('用户名或密码错误,请重新输入');
Edit1.Clear;
edit2.Clear;
end
else
begin
ADOQuery1.SQL.Text:='select * from student where sno='''+username+'''';
ADOQuery1.open;
if ADOQuery1.RecordCount=0 then
begin
ADOQuery1.SQL.Text:='select * from teacher where tno='''+username+'''';
ADOQuery1.open;
if ADOQuery1.RecordCount=0 then
begin
Form5.Show;
Form1.close;
end
else
begin
Form4.show;
Form1.Close;
end;
end
else
begin
Form3.Show;
Form1.Close;
end;
end;
end;
if errcount=3 then
begin
showMessage('连续三次密码错误,系统退出!');
application.Terminate;
end;end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货