Page 1 of 1

OnUpdateRecord with SDAC 4.50

Posted: Thu 31 Jul 2008 20:47
by Ludek
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]

Posted: Fri 08 Aug 2008 06:47
by Challenger
You have to change PerformUpdate, PerformAppend, PerformDelete to DoPerformUpdate, DoPerformAppend, DoPerformDelete correspondingly.

Posted: Mon 11 Aug 2008 17:29
by Ludek
Thanks much, it works.
(I only don't understand, that I didn't find it myself :shock: )