我想用adostroedproc返回一个数据集:如 select a from table_a
在前端用adoquery进行子查询:
如adoquery.sql.add(select * from table_b where a in .....?);
这里应该怎样把adostroedproc中的数据返回给adoquery作为查询参数.
在前端用adoquery进行子查询:
如adoquery.sql.add(select * from table_b where a in .....?);
这里应该怎样把adostroedproc中的数据返回给adoquery作为查询参数.
不就可以吗!
example :class function getsqlstr(fieldname,resultstr:string,qry:tquery):boolean;
var
fieldlist:Tstringlist;
begin
fieldlist:=Tstringlist.create;
while qry.eof do
begin
fieldlist:=fieldlist+','+qry.fieldbyname('+fieldname+').asstring;
qry.next;
end;
resultstr:=copy(fieldlist,2,length(fieldlist)-1);
if length(resultstr)<>0 then result:=true
else result;=false;
end;
var
str:string;
if getsqlstr('your fieldname',resultstr,your query1) then
str:=resultstr;
Query1.close;
Query1.sql.text;='select....in(str)'
Query1.open;
ok;