var
aintf:_Recordset;
RecordsAffected:OleVariant;
begin
ADOStoredProc1.Close;
ADOStoredProc1.Open;
aintf:=ADOStoredProc1.Recordset;
ADOQuery1.Recordset:=aintf;
aintf:=aintf.NextRecordset(RecordsAffected);
ADOQuery2.Recordset:=aintf;
end;
此时,把存储过程中生成的二个数据集分别在adoquery1,adoquery2中,将adoquery1,adoquery2与DBGrid相连中,即可.
其实,把_Recordset放到MemTable中更好.
下面是普遍的方法:
aintf:=ADOStoredProc1.Recordset;
while Assigned(aintf) do
begin
//处理当前记录集.
aintf:=aintf.NextRecordset(RecordsAffected);//取下一个记录集
end;