Subject EIB_DatasetError: Dataset to update not found
Author patrick_marten
EIB_DatasetError: Dataset to update not found


Hello,

I have a routine where I'm going through several tables, look for certain fields, change their content / value via a DB-aware control and post the changes.

There is one table where this fails, although several tables before and afterwards work fine.

With this table I'm getting an DatasetError with the message (translated) "Dataset to update not found".

To make sure, that it isn't the DB-aware control, which is causing trouble, I've tried <Field>.Value := <Field>.Value and the same error occurs when I try to post the changes.

So basicaly it looks like this:

IBOQuery1.Close;
IBOQuery1.SQL.Clear;
IBOQuery1.SQL.Add('select * from TABLE1');
IBOQuery1.Open;
if not (IBOQuery1.Bof and IBOQuery1.Eof) then begin
IBOQuery1.First;
while not IBOQuery1.Eof do begin
try
for myCounter := 1 to 5 do begin
myCurrentFieldName := 'FIELD' + Format('%2.2d', [myCounter]);

if not IBOQuery1.FieldByName(myCurrentFieldName).IsNull then begin
// the next two rows are normaly not there as the DB-aware control takes care of the changes
// the error occurs anyway...
IBOQuery1.Edit;
IBOQuery1.FieldByName(myCurrentFieldName).Value := IBOQuery1.FieldByName(myCurrentFieldName).Value;

if IBOQuery1.State in [dsEdit, dsInsert] then begin
IBOQuery1.Post;
end;
end;
end;
except

end;

IBOQuery1.Next;
end;
end;


I repeat this block for several tables and as I said: it works for all but one somewhere in the middle... The fields I'm updating do exist in other tables as well, i.e. the same datatype etc. (BLOB SUB_TYPE 0).

The dataset is open and in edit mode. The ID of the dataset is correct as well. Fields to edit do exist and assigning of the value works. The check if field.IsNull works too, but post and later commit cause the error.

What could be wrong here?

DelphiXE, IBO 4.9.14 Build 50

Regards,
Patrick