OnStateChange - changed field values not saved

Here's a little gotcha (bug ?) in the ADOExpress/dbGO components:

If you call Insert on a TADODataSet, then if the value of a field is changed
within the OnStateChange event of a TDataSource connected to that dataset,
then those changes are not written to the database when calling post. This
is because after the OnStateChange event occurs, one of the first things the
ADODataSet then does is clear the FModifiedFields list within DoOnNewRecord,
which means that when Post is called the values of these fields are not
copied to the underlying recordset, as these changed fields are no longer in
the list of modified fields. A simple work-around, and probably a better
approach anyway, is to set values in the  OnNewRecord event of the
ADODataSet. Mind you, if TField's DefaultExpression worked with ADODatasets
then this wouldn't be necessary, but that's another story.

I mention this as it isn't exactly documented that you aren't allowed to
changed field values within OnStateChange.

Andy Mackie.