Exception in CachedUpdates ApplyUpdates

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
JGordon
Posts: 10
Joined: Tue 27 Sep 2011 16:43

Exception in CachedUpdates ApplyUpdates

Post by JGordon » Fri 11 May 2012 16:41

I have code that deletes the detail records in a master/detail set of tables. The detail table is in CachedUpdate and I have code that reads:

with Tbl do
begin
DisableControls;
try
First;
while not EOF do
Delete;
if CachedUpdates and UpdatesPending then
begin
ApplyUpdates;
CommitUpdates;
end;
finally
EnableControls;
end;
end;

This gives me an exception in the ApplyUpdates. The MemData.pas, in the ApplyUpdates procedure on line 7205 which reads

if OldCurrentItem.Flag = flUsed then
CurrentItem := OldCurrentItem;

Then OldCurrentItem is nil and so it causes a problem. If I put an:

if OldCurrentItem<>nil

before the lines, it seems to work. Is there any problem with doing this?

Thanks,

AndreyZ

Re: Exception in CachedUpdates ApplyUpdates

Post by AndreyZ » Mon 14 May 2012 07:27

Hello,

We fixed the bug at executing ApplyUpdates in SDAC 6.1.5 . To solve the problem, you should upgrade SDAC at least to this version.

Post Reply