![](/img/trans.png)
[英]How to update a TClientDataSet with changes made to the DB without it knowing?
[英]How can I refresh a TClientDataSet without applying pending updates?
这是我想要完成的:
当我执行第 3 步时,我收到“必须在刷新数据之前应用更新”。
如何在不应用挂起更新的情况下刷新 TClientDataSet?
您可以调用AppendData方法将数据包手动附加到您的数据集。
在提供程序与 ClientDataSet 位于同一应用程序中的应用程序中,您可以编写如下代码:
begin
ConfigureProviderToGetRecordWithID(1);
//make the ClientDataSet fetch this single record and not hit the EOF.
ClientDataSet1.PacketRecords := 1;
ClientDataSet1.Open;
ClientDataSet1.Edit;
ModifyFirstRecord;
ClientDataSet1.Post;
ConfigureProviderToGetRecordWithID(2);
ClientDataSet1.AppendData(DataSetProvider1.Data, False);
//now you have two records in your DataSet without losing the delta.
end;
这是一种伪代码,但显示了您可以使用的一般技术。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.