忘了说明:
Indicates whether the cached updates buffer contains records that
are not yet applied.
property UpdatesPending: Boolean;
Description
Examine UpdatesPending to check the status of the cached updates
buffer. If UpdatesPending is True, then there are edited, deleted, or
inserted records to apply to the database. If UpdatesPending is
False, there are no records in the cache.
但是,一条正在编辑的记录是不会放到buffer中去的,所以要加上
(DataSet.State in [dsEdit, dsInsert])
同理,单是(DataSet.State in [dsEdit, dsInsert])也不够,一条编辑过的记录
Post之后,DataSet.State就会恢复为dsBrowse,不过此时DataSet.UpdatesPending 就已经等于True