首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Server端更新数据后通知Client端显示

Posted on 2010-11-24 11:22  colincode  阅读(1071)  评论(0编辑  收藏  举报

原来的Client的ApplyUpdatesError事件己经没有了

换成  Client的RemoteDataAdapter的 BeforeProcessFailures 事件

Server:ProcessorAfterProcessChange事件或ProcessorBeforeProcessChange

 

CanRemoveFromDelta := FALSE;

 

 case aChange.ChangeType of
    ctInsert : begin
      customerid := aChange.NewValueByName['CustomerID'];
      aChange.Message := Format('Customer %s has been inserted',
                                [customerid]);
    end;
    ctUpdate : begin
      customerid := aChange.OldValueByName['CustomerID'];
      aChange.Message := Format('Customer %s has been updated',
                                [customerid]);
      end;
    ctDelete : begin
      customerid := aChange.OldValueByName['CustomerID'];
      aChange.Message := Format('Customer %s has been deleted',
                                [customerid]);
    end;
 end;

 aChange.Status := csFailed;//aChange.Status :=csResolved;csResolved通知客户端己经修正了

 

Client:

BeforeProcessFailures事件中

var I:Integer;
begin
  aFailureBehavior := fbNone;
  for I := 0 to AFailedDeltas.Count-1 do
  begin
    Memo.Lines.Add((TDADeltaChange(AFailedDeltas[i]).Message));
  end;
end