这个sql语句为什么会错?

windforce123 2006-02-15 09:18:21

rt
ADOQUERY1.Close;
ADOQUERY1.SQL.Clear;
ADOQUERY1.SQL.Add('select * from admin where id='luoqun'');
ADOQUERY1.open;
编译可通过,执行就出错, 说'luoqun'无效。
在查询分析器下执行无误。
我换成了ADOQUERY1.SQL.Add('select * from admin where id="'luoqun'"');

或者把单引号改为 +char(39) 连编译都无法通过了。。

。。望指点~~ 多谢~!!

在线等

...全文
74 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhuminghua 2006-02-15
  • 打赏
  • 举报
回复
ADOQUERY1.SQL.Add('select * from admin where id=''luoqun''');
现在这里的人好像越来越少了
jinjazz 2006-02-15
  • 打赏
  • 举报
回复
ADOQUERY1.SQL.Add('select * from admin where id='''luoqun'''');
mountainclamber 2006-02-15
  • 打赏
  • 举报
回复
ADOQUERY1.Close;
ADOQUERY1.SQL.Clear;
ADOQUERY1.SQL.Add('select * from admin where id=:a');
ADOQUERY1.Parameters[0].Value:='rrrrr';
ADOQUERY1.open;
windforce123 2006-02-15
  • 打赏
  • 举报
回复
自己解决了。。。



想请教下各位。。什么时候这里人多呢?? 找个人多的时候来问问题的好~

2,498

社区成员

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

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