Go to the next cursor, returned by the SQL command.
The NextRecordSet method closes current cursor, forwards it to the next accessible cursor and opens dataset. If there is no more accessible cursors, then after call dataset is closed. See "Command Batches" chapter for more details.
For AnyDAC the Oracle and PostgreSQL REF CURSOR is a command cursors, and a NextRecordSet call will select the next REF CURSOR parameter. For SQL Server, Sybase SQL Anywhere, MySQL, etc a NextRecordSet call will select next result set, produced by batch, stored procedure or how else.
In design time, you can forward dataset to the next cursor, by right clicking component and choosing the "Next record set" popup menu item. See the "Executing Command" chapter for more details.
ADQuery1.FetchOptions.AutoClose := False; ADQuery1.SQL.Text := 'select 1 as i; select ''qwe'' as s'; ADQuery1.Open; ShowMessage(ADQuery1.Fields.FieldName + ' ' + ADQuery1.Fields.AsString); // output "i 1" ADQuery1.NextRecordSet; ShowMessage(ADQuery1.Fields.FieldName + ' ' + ADQuery1.Fields.AsString); // output "s qwe" ADQuery1.Close;
What do you think about this topic? Send feedback!