Page 1 of 1

ApplyUpdates does not always update database correctly

Posted: Fri 16 Jul 2010 01:30
by yozey
Hi I'm having an issue with TPgTable and ApplyUpdates. What is happening is that if I change a value in a field and call ApplyUpdates the field is changed in the underlying dataset. However if I immediately change the value back to it's original value, the ApplyUpdates does not change it. I confirmed this by monitoring the SQL statement created and sent to the server. On the second update the field that is changed to the original value is not included in the SQL statement.

What would be the cause of this?

Posted: Fri 16 Jul 2010 12:34
by bork
Hello

By default DAC dataset stores fields that were changed only. If you change the value back, then dataset will consider that this field was not changed.

If you want to save all fields in any case, then you should set the Options.UpdateAllFields option to True.

Posted: Fri 16 Jul 2010 12:45
by yozey
This works! Thank you.