+ -
当前位置:首页 → 问答吧 → 求救:SQL和单引号的问题。

求救:SQL和单引号的问题。

时间:2011-12-13

来源:互联网

代码如下:运行出错。实在算不清timetostr这里要多少个单引号了。请大家帮帮忙,非常感谢。
DM1.adoplay.SQL.Add('select * from '+main.mbtext+'where 时间='''+timetostr(now())'''');

作者: kk0366   发布时间: 2011-12-13

DM1.adoplay.SQL.Add('select * from '+main.mbtext+'where 时间='+''''+timetostr(now())+'''')

这样试试

作者: bigpanax   发布时间: 2011-12-13

我一般是用#39代替字符串里的单引号 看起来比''''直观点

作者: cm2004   发布时间: 2011-12-13

SQL code
DM1.adoplay.SQL.Add('select * from '+main.mbtext+'where 时间 = '+ #39 + timetostr(now()) + #39 ');

作者: cm2004   发布时间: 2011-12-13

('select * from '+main.mbtext+' where 时间='+Quotedestr(timetostr(now())));

作者: kaikai_kk   发布时间: 2011-12-13