Looping through a TOracleDataSet's Cursor result

I'd like to loop through a TOracleDataSet's Cursor. I want to do some calculations before the data is used in a DBGrid. So, in the OracleDataSetAfterQuery I'm trying to do something like

OracleDataSet.Last;
while not OracleDataSet.Bof do
begin
OracleDataSet.Prior;
CalcSomething;
end;

The error I get is "Cannot perform this operation on a closed dataset." I'd be happy if I could loop forwards instead. I understand that the cursor may be unidirectional so that .Last doesn't work. However, .First doesn't work either. Same error message.

BTW, I'm not returning a rowid with the cursor. Would this help here? I'll go try that... I'll also try AfterFetchRecord to see if that can be used...

Dan
 
You will have to use the AfterOpen event instead. During AfterQuery the dataset is still closed.

You can use TOracleDataSet.DisableControls/EnableControls to prevent any visual side-effects of your calculations.

------------------
Marco Kalter
Allround Automations
 
Back
Top