Board index » delphi » TDataset.UpdateRecord Doesn't work for me ?!?

TDataset.UpdateRecord Doesn't work for me ?!?

Hi,

Maybe I got this wrong but my understanding of the UpdateRecord Procedure is
to allow for the verification of each record before they are posted to the
Database in a TQuery or TTable when Cached Updates is set to True.

Now I have code here that I think would work but it doesn't if you know why
let me know.  There are no Delphi Exemple provided and the Delphi Help is
very limmited.

procedure TDM_TransMonitor.Query1UpdateRecord(
  DataSet: TDataSet; UpdateKind: TUpdateKind;
  var UpdateAction: TUpdateAction);
begin
  If DataSet.FieldByName('RECORDID').AsString = '24'
  Then Begin
    UpdateAction := uaApplied ;
  End
  Else UpdateAction := uaSkip ;
end;

This code goes down the If Then Branch and it doesn't depending on the
condition.  Thsi part works.  What doesn't is that I does nothing!   All the
record yout a RecordID of 24 stays in the Query same as the other record
with a recordID other than 24.

Am I supposed to do something to actually write the data to the Database ?
what Am I doing wrong?

eric
ejod...@inetex.com

 

Re:TDataset.UpdateRecord Doesn't work for me ?!?


Before you can change the contents you must enter the EDIT mode, then
exit the Edit mode, this indicates a change mayhave been taking place thus
the
system up dates.
 also selecting another record will purge the current and update it if it
was in
edit mode..

Eric Jodoin <ejod...@inetex.com> wrote in article
<35b6e5c...@204.239.181.11>...

Quote
> Hi,

> Maybe I got this wrong but my understanding of the UpdateRecord Procedure
is
> to allow for the verification of each record before they are posted to
the
> Database in a TQuery or TTable when Cached Updates is set to True.

> Now I have code here that I think would work but it doesn't if you know
why
> let me know.  There are no Delphi Exemple provided and the Delphi Help is
> very limmited.

> procedure TDM_TransMonitor.Query1UpdateRecord(
>   DataSet: TDataSet; UpdateKind: TUpdateKind;
>   var UpdateAction: TUpdateAction);
> begin
>   If DataSet.FieldByName('RECORDID').AsString = '24'
>   Then Begin
>     UpdateAction := uaApplied ;
>   End
>   Else UpdateAction := uaSkip ;
> end;

> This code goes down the If Then Branch and it doesn't depending on the
> condition.  Thsi part works.  What doesn't is that I does nothing!   All
the
> record yout a RecordID of 24 stays in the Query same as the other record
> with a recordID other than 24.

> Am I supposed to do something to actually write the data to the Database
?
> what Am I doing wrong?

> eric
> ejod...@inetex.com

Other Threads