Board index » delphi » problem with default values using chached updates

problem with default values using chached updates

The following problem I found when changing to
cached updates with tupdate-object:

As Delphi creates the update-statement for
as to update ALL fields, it sends null-values
for the fields I did not enter values to.

Getting explicit null-values the server does not
use his defaults, which results in an error on not null-fields.

So, do I really have to change my update-statement any time ?

I tried to enter the defaults in the TFields of my query which seemed
to work fine. But when I activate then cached updates-property
and do a TQuery.Insert no default values are shown.

anyone any idea ?

Michael Aigner
SAZ Marketing Services - Vienna - Austria

 

Re:problem with default values using chached updates


I suspect TField.DefaultExpression only works with live queries.  Two
choices (at least):

* The easy one:  use OnNewRecord to set field values to defaults, or

* Dynamically modify the update SQL to only update fields that have been
modified (NewValue <> OldValue).  This will probably require you to subclass
the TUpdateSQL component (at least that's how we did it).  You will derive
other benefits from this also, including enhanced performance.

V/R
Russell L. Smith

Quote
Michael Aigner wrote in message <6uoa4l$j...@forums.borland.com>...
>As Delphi creates the update-statement for
>as to update ALL fields, it sends null-values
>for the fields I did not enter values to.

Other Threads