Hi,
I am using FireBird and I wonder if there is a method or function can get the next or prior ID of the current record without moving the dataset cursor ?
Thanks
next and prior record ID without moving dataset cursor
-
AndreyZ
Re: next and prior record ID without moving dataset cursor
Hello,
The TDataSet component (which all dataset components are based on) does not have such functionality. You can write about this feature to the Embarcadero support.
As a solution, you can use the Next and Prior methods of the TDataSet component. To prevent visual database components of updating, you should call the DisableControls method before changing the current record, and call the EnableControls method after the job is done. Here is a code example:
The TDataSet component (which all dataset components are based on) does not have such functionality. You can write about this feature to the Embarcadero support.
As a solution, you can use the Next and Prior methods of the TDataSet component. To prevent visual database components of updating, you should call the DisableControls method before changing the current record, and call the EnableControls method after the job is done. Here is a code example:
Code: Select all
var
nextID: integer;
begin
IBCQuery1.DisableControls;
IBCQuery1.Next;
nextID := IBCQuery1.FieldByName('id').AsInteger;
IBCQuery1.Prior;
IBCQuery1.EnableControls;
ShowMessage(IntToStr(nextID));
end;-
AndreyZ
Re: next and prior record ID without moving dataset cursor
Glad to help. If any other questions come up, please contact us.