SDAC

TCustomMSDataSet.OpenNext Method

Opens next rowset in the statement.

Class

TCustomMSDataSet

Syntax

function OpenNext: boolean;

Return Value
True, if DataSet opens.

Remarks

Call the OpenNext method to get the second and other ResultSets while executing a multiresult query. If DataSet opens, it returns True. If there are no record sets to be represented, it will return False, and the current record set will be closed. Has effect only for the ctDefaultResultSet cursor. The OpenNext method isn't compatible with TCustomDADataSet.Prepare.

Example

Here is a small piece of code that demonstrates the approach of working with multiple datasets returned by a multi-statement query:

MSQuery.SQL.Clear;
   MSQuery.SQL.Add('SELECT * FROM Table1;');
   MSQuery.SQL.Add('SELECT * FROM Table2;');
   MSQuery.SQL.Add('SELECT * FROM Table3;');
   MSQuery.SQL.Add('SELECT * FROM Table4;');
   MSQuery.SQL.Add('SELECT * FROM Table5;');
   MSQuery.FetchAll := False;
   MSQuery.Open;
   repeat
      //   < do something >
      until not MSQuery.OpenNext; 

See Also

© 1997-2024 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback