Delphi-将Delta应用于TClientDataSet [英] Delphi - applying Delta to a TClientDataSet
问题描述
我的应用程序使用 TClientDataSet
和 TDataSource
集。不涉及数据库
。 TClientDataSet
以 XML
格式保存。我使用 DataSet.SaveToFile
方法保存 TClientDataSet
,这样做,保存的文件将保留Delta更改。我不能使用 DataSet.UpplyUpdates
方法,因为如前所述,没有 DataBase
因此没有 Provider
也是如此。
My application uses a TClientDataSet
and a TDataSource
set. No DataBase
involved. The TClientDataSet
is saved in XML
format. I save the TClientDataSet
using the DataSet.SaveToFile
method, and doying so, the saved file retains the Delta changes. I can't use the DataSet.UpplyUpdates
method, because as stated before, there is no DataBase
hence there is no Provider
also.
DataSet.SaveToFile('SavedFile.XML')//此保留Delta更改
DataSet.ApplyUpdates(0)//无法使用(无提供程序)
我的问题是:如何才能强制将Delta更改应用于 TClientDataSet
保存到文件?如果保存为 binary
格式,是否将应用Delta更改?
注意:关闭并随后打开 TClientDataSet
也不起作用。
My question is: how can I force to apply the Delta changes to the TClientDataSet
before saving it to a file? If a save to a binary
format, the Delta changes would be applied?.
Note: closing and subsequently open the TClientDataSet
does not work either.
推荐答案
要擦除已保存的更改,只需调用 TCustomClientDataSet.MergeChangeLog
。
To erase the saved changes just call TCustomClientDataSet.MergeChangeLog
.
如果根本不需要更改日志,请设置 TCustomClientDataSet.LogChanges
到<$ c刚打开数据集之后,$ c> False ( True
是默认值)。
If you do not need the change log at all, set TCustomClientDataSet.LogChanges
to False
(True
is default value) just after open the dataset.
这篇关于Delphi-将Delta应用于TClientDataSet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!