转意字符,如果你的struser=adan, strTableName=AA 那么'select * from PubDBGridStyle where PubLoginUser='''+strUser+''' and PubTableName='''+strTableName+''''); 表达的意思就是select * from PubDBGridStyle where Publoginuser='adan' and pubtablename = 'AA'; ''' '''' 就是' ''
delphi中字符串用''表示,如字符串hello表示为'hello' delphi中的sql语句两对单引号表示一对单引号; delphi中(参数表,也包括sql语句)把一个变量的值赋给另一个变量需要'+ +',如 a,b: string; ... a := 'hello'; b := '+a+‘;(参数表) b := '''+a+'''(sql中)不知这样说对不对?
qrytemp:=tadoquery.Create(nil);
在上述语句中,NIL是什么意思?
所以单独的''''表示SQL语句里的一个'
那么'select * from PubDBGridStyle where PubLoginUser='''+strUser+''' and PubTableName='''+strTableName+'''');
表达的意思就是select * from PubDBGridStyle where Publoginuser='adan' and pubtablename = 'AA';
''' '''' 就是' ''
delphi中的sql语句两对单引号表示一对单引号;
delphi中(参数表,也包括sql语句)把一个变量的值赋给另一个变量需要'+ +',如
a,b: string;
...
a := 'hello';
b := '+a+‘;(参数表)
b := '''+a+'''(sql中)不知这样说对不对?