关于循环语句取值问题
for I := 0 to edtZjfs.Items.Count - 1 do
begin
if edtZjfs.checked[i] then
begin
if R.Zjfsstr1 = '' then
R.Zjfsstr1 := '''' + Trim(edtZjfs.Items.Strings[i]) + ''''
else
R.Zjfsstr1 := R.Zjfsstr1 + ',' + '''' + Trim(edtZjfs.Items.Strings[i]) + '''';
end;
end;
edtZjfs是CheckedComboBox控件
需要取多个增加方式的值来进行查询,SQL语句是 select * from a where zjfs in (R.zjfsstr1)
可是选两个数据的时候是可以的,如果选中三个的话,会出现select *from a where zjfs in ('购买','赠送','政府?
想请教一下是怎么回事,急,谢谢各位了。
[解决办法]
啊哦。。。
帮顶
[解决办法]
写进sql 前 把 R.Zjfsstr1 showmessage show出来看看。
多做些调试,看问题出现在具体的那句语句里!