you can do Recordset.NextRecordset, some code from MSDN,as in VB:SQLCompound = "SELECT * FROM Authors; " & _
      "SELECT * FROM stores; " & _
      "SELECT * FROM jobs"
   rstCompound.Open SQLCompound, Cnxn, adOpenStatic, adLockReadOnly, adCmdText   ' Display results from each SELECT statement
   intCount = 1
   Do Until rstCompound Is Nothing
      Debug.Print "Contents of recordset #" & intCount
      
      Do Until rstCompound.EOF
         Debug.Print , rstCompound.Fields(0), rstCompound.Fields(1)
         rstCompound.MoveNext
      Loop
   
      Set rstCompound = rstCompound.NextRecordset
      intCount = intCount + 1
   Loop

解决方案 »

  1.   

    var
      TempDataSet: TCustomSQLDataSet;
      nRows: Integer;
    begin
      TempDataSet := SQLStoredProc1; // start with 1st record set
      while TempDataSet <> nil do
      begin
        TempDataSet.First;
        while not TempDataSet.Eof do
        begin
          // process each record
          TempDataSet.Next;
        end;
        if TempDataSet <> SQLStoredProc1 then // don抰 free the original!
          TempDataSet.Free;    TempDataSet = SQLStoredProc1.NextRecordSet; // get next set
      end;
    end;