Subject Re: [IBO] Exception "Record was not located to update"
Author Michel LE CLEZIO
May be this not the explication but in your example you forget something like : With ADataSet do... :


with ADataSet do
begin
 _Pos := GetBookmark;
        try
           if Modified and CanModify then
            Post;
         if BookmarkValid(_Pos) and (not IsEmpty) then
             GotoBookmark(_Pos);
           finally
              FreeBookmark(_Pos);
             ApplyUpdates;
          end;      
end;


With best Regards,
Michel




Le Vendredi 25 août 2017 11h09, "laurent.gilbert@... [IBObjects]" <IBObjects@yahoogroups.com> a écrit :


 
Hi Guys,

I have a problem with TIBOTable on record update. 

CachedUpdates is enabled.

"ApplyUpdates" generates the exception "Record was not located to update".

Has anyone run into the same problem and knows how to solve it ?

More infos :

1) I recompiled my old application with DELPHI 10.2 and IBO 5.9.5.2652.
2) Previous version was build with DELPHI SEATTLE and IBO 5.7.7.2340 ; and all is working.

My general code to save the changes is :

procedure ibValiderModifications(ADataSet : TIBODataSet); 
var 
 _Pos : TBookMark; 
begin 
// if state in [dsInsert, dsEdit, dsSetKey] then
// CheckBrowseMode;

_Pos := GetBookmark;
        try
   if Modified and CanModify then
   Post;

    ApplyUpdates;

   if BookmarkValid(_Pos) and (not IsEmpty) then
   GotoBookmark(_Pos);
        finally
   FreeBookmark(_Pos);
        end;

I put the "checkbrowsemode" in comment to see... but the exception is still present...

This code works when it is called with a TIBOQUERY.

Thanks.