怎样书写这个sql语句,感激不尽(10分)

C

cjhk007

Unregistered / Unconfirmed
GUEST, unregistred user!
有以下语句关键是sql不对
begin
with query1 do
begin
close;
with SQL do
begin

clear;
add('select Pattern,BodyLen,Jiaokou,ChestRnd from TBHType');
add('where Continent=edit2.text');
end;
open;
end;
end;
对于add('select Pattern,BodyLen,Jiaokou,ChestRnd from TBHType where BodyLen=10');
可以很好的执行,但是
对于对于add('select Pattern,BodyLen,Jiaokou,ChestRnd from TBHType where Pattern=一个字符串');
怎么书写呢?
 
可以用参数
 
要这样写
add('select Pattern,BodyLen,Jiaokou,ChestRnd from TBHType');
add('where Continent=' + edit2.text );
如果Continent不是字符型字段的话还要进行转换!
 
如果是一个字符串的话,改成:
clear;
add('select Pattern,BodyLen,Jiaokou,ChestRnd from TBHType');
add('where Continent='+''''+edit2.text+'''');
end;

菜答,不知道对不对?
 
"'+edit2.text+'"
或者用参数好了。
 
易名烦 is right
 
顶部