在线等急:ADOQuery之SQL问题

ludingsky 2007-05-12 09:23:35
我程式有这样一段
ADOQuery1.SQL.add( 'select * from 用户登录 where 用户名=luding');
但执行了这程式就会报EOleException出错。还有就是access参数不足
我想应该是这语句问题
ADOQuery1.SQL.add( 'select * from 用户登录 where 用户名="luding"');
改成这样也出错
我全程式在这

procedure Tloginform.Button1Click(Sender: TObject);
begin
ADOQuery1.sql.clear;
ADOQuery1.SQL.add( 'select * from 用户登录 where 用户名=luding') ;
ADOQuery1.active:=true;
if ADOquery1.RecordCount >0 then
begin
Application.CreateForm(TKFruzhanForm, KFruzhanForm) ;
KFruzhanForm.show;
end
else
begin
messagedlg('用户名或密码错误!!',mtcustom,[mbok],0) ;
end;
end;


end.
...全文
159 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
jerry8 2007-05-12
  • 打赏
  • 举报
回复
'select * from 用户登录 where 用户名='''+luding+''''
zhao_yong 2007-05-12
  • 打赏
  • 举报
回复
ADOQuery1.SQL.add( 'select * from 用户登录 where 用户名='''+'luding'+'''');
scvzhang 2007-05-12
  • 打赏
  • 举报
回复
ADOQuery1.SQL.add( 'select * from 用户登录 where 用户名=' + QuotedStr(luding) );
naner_china 2007-05-12
  • 打赏
  • 举报
回复
'select * from 用户登录 where 用户名=''''luding'''''
alan 2007-05-12
  • 打赏
  • 举报
回复
用ADOQUERY之前要關閉,ADOQuery1.CLOSE;
Cherish20 2007-05-12
  • 打赏
  • 举报
回复
ADOQuery1.SQL.add( 'select * from [用户登录] where [用户名]='+quotedstr(luding)+'');
joychou 2007-05-12
  • 打赏
  • 举报
回复
嘎嘎,我以前也遇到过同样的问题!!
ADOQuery1.SQL.add( 'select * from 用户登录 where 用户名='''+'luding'+'''');

2,507

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧