OnUpdateRecord with SDAC 4.50

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Ludek
Posts: 296
Joined: Thu 12 Oct 2006 09:34

OnUpdateRecord with SDAC 4.50

Post by Ludek » Thu 31 Jul 2008 20:47

Hi,

I sometimes need to make some other update operation within OnUpdateRecord-event than the user made in the dataset - typically: user edited a dataset and cleared a value and i need to delete the record, not only modify it to NULL.

I programmed a subclass of TMSQuery full of useful code and among others I also included following method:

Code: Select all

procedure TMyMSQuery.StandardApply(updatekind: TUpdateKind);
begin
  case UpdateKind of
    ukModify:
      PerformUpdate;
    ukInsert:
      PerformAppend;
    ukDelete:
      PerformDelete;
  end;
end;
I called then simply msquery.StandardApply(ukDelete) in the OnUpdateRecord handler - example:

Code: Select all

if UpdateKind = ukModify then begin
  if varIsNull(myfield.NewValue)
     myquery.standardapply(ukDelete)
  else
     myquery.standardapply(ukModify)
end;
With 4.50, the "standardapply" code does not get compiled any more.
Please, could you tell me, how could I implement such very needed behavior with SDAC 4.50?
Thanks.[/code]

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Fri 08 Aug 2008 06:47

You have to change PerformUpdate, PerformAppend, PerformDelete to DoPerformUpdate, DoPerformAppend, DoPerformDelete correspondingly.

Ludek
Posts: 296
Joined: Thu 12 Oct 2006 09:34

Post by Ludek » Mon 11 Aug 2008 17:29

Thanks much, it works.
(I only don't understand, that I didn't find it myself :shock: )

Post Reply