delphi 7 出现Undeclared identifier: 'ADOQuery1'该怎么解决?
写了这样一段代码,但是不停报错;procedureTForm1.Button1Click(Sender:TObject);beginifedit1.Text=''then...
写了这样一段代码,但是不停报错;
procedure TForm1.Button1Click(Sender: TObject);
begin
if edit1.Text='' then
begin
showmessage('请输入用户名');
exit;
end;
if edit2.Text='' then
begin
showmessage('请输入密码');
exit;
end;
with ADOQuery1 do
begin
close;
sql.clear;
sql.add('select * from yh where name='''+edit1.text+''' and password='''+edit2.text+''' ');
open;
begin
if bof and eof then
showmessage('错误');
exit;
else
showmessage('yes') ;
end;
end;
end;
end;
Build
[Error] Unit1.pas(43): Undeclared identifier: 'ADOQuery1'
[Error] Unit1.pas(46): Undeclared identifier: 'sql'
[Error] Unit1.pas(47): Missing operator or semicolon
[Error] Unit1.pas(48): Undeclared identifier: 'open'
[Error] Unit1.pas(50): Undeclared identifier: 'bof'
[Error] Unit1.pas(50): Operator not applicable to this operand type
[Error] Unit1.pas(53): ';' not allowed before 'ELSE'
[Error] Unit1.pas(59): '.' expected but ';' found
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
求解 展开
procedure TForm1.Button1Click(Sender: TObject);
begin
if edit1.Text='' then
begin
showmessage('请输入用户名');
exit;
end;
if edit2.Text='' then
begin
showmessage('请输入密码');
exit;
end;
with ADOQuery1 do
begin
close;
sql.clear;
sql.add('select * from yh where name='''+edit1.text+''' and password='''+edit2.text+''' ');
open;
begin
if bof and eof then
showmessage('错误');
exit;
else
showmessage('yes') ;
end;
end;
end;
end;
Build
[Error] Unit1.pas(43): Undeclared identifier: 'ADOQuery1'
[Error] Unit1.pas(46): Undeclared identifier: 'sql'
[Error] Unit1.pas(47): Missing operator or semicolon
[Error] Unit1.pas(48): Undeclared identifier: 'open'
[Error] Unit1.pas(50): Undeclared identifier: 'bof'
[Error] Unit1.pas(50): Operator not applicable to this operand type
[Error] Unit1.pas(53): ';' not allowed before 'ELSE'
[Error] Unit1.pas(59): '.' expected but ';' found
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
求解 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询