在中间层可以这么做: procedure TMyRemoteDataModule.dspMBoxBeforeUpdateRecord( Sender: TObject; SourceDS: TDataSet; DeltaDS: TClientDataSet; UpdateKind: TUpdateKind; var Applied: Boolean); begin case UpdateKind of ukInsert: begin DeltaDS.Edit; DeltaDS['FILE_DATE'] := Date; DeltaDS.Post; end end end;
>> chechy(我爱洁洁) ( ) : 1. procedure TMyRemoteDataModule.dspMBoxBeforeUpdateRecord( Sender: TObject; SourceDS: TDataSet; DeltaDS: TClientDataSet; UpdateKind: TUpdateKind; var Applied: Boolean); begin case UpdateKind of ukInsert: begin DeltaDS.Edit; DeltaDS['FILE_DATE'] := Date; //这一句什么意思?我想在中间层改变其中的某一字段的值,能写 //为:DeltaDS.FIELDVALUE['AFIELDNAME'] := AData; 吗? //case UpdateKind of //ukInsert: begin...之后 //要不要再执行DeltaDS.Insert方法呢? DeltaDS.Post; //这已在中间层了,为什么不直接DeltaDS.ApplyUpdates();? end end end;2. 我不知道怎么分解Delta或Data数据包,能介绍Delta或Data数据包格式?
只需處理DataSetProvider.BeforeUpdateRecord
客户ApplyUpdates()后,我想在中间层改变其中的某些字段的值,谁能给个例子么?
procedure TMyRemoteDataModule.dspMBoxBeforeUpdateRecord(
Sender: TObject; SourceDS: TDataSet; DeltaDS: TClientDataSet;
UpdateKind: TUpdateKind; var Applied: Boolean);
begin
case UpdateKind of
ukInsert: begin
DeltaDS.Edit;
DeltaDS['FILE_DATE'] := Date;
DeltaDS.Post;
end
end
end;
1.
procedure TMyRemoteDataModule.dspMBoxBeforeUpdateRecord(
Sender: TObject; SourceDS: TDataSet; DeltaDS: TClientDataSet;
UpdateKind: TUpdateKind; var Applied: Boolean);
begin
case UpdateKind of
ukInsert: begin
DeltaDS.Edit;
DeltaDS['FILE_DATE'] := Date;
//这一句什么意思?我想在中间层改变其中的某一字段的值,能写
//为:DeltaDS.FIELDVALUE['AFIELDNAME'] := AData; 吗?
//case UpdateKind of
//ukInsert: begin...之后
//要不要再执行DeltaDS.Insert方法呢?
DeltaDS.Post;
//这已在中间层了,为什么不直接DeltaDS.ApplyUpdates();?
end
end
end;2.
我不知道怎么分解Delta或Data数据包,能介绍Delta或Data数据包格式?
Data数据包我心中的疼!!!!
中间层已经处于ApplyUpdates中了,所以不能在ApplyUpdates。
你如果真想知道Delta的格式,可以这样:
Drop一个ClientDataset,然后Cds1.Data := YourCds1.Delta;
然后用DBGrid看看cds1中的数据。
>>Drop一个ClientDataset,然后Cds1.Data := YourCds1.Delta;
>>然后用DBGrid看看cds1中的数据。]这样能看cds1中的数据,但如何分解呢?Delphi中Delta,Data数据包打包、解包原理?望大家指教小弟。
1、不可能知道,代码都在midas.dll中。
2、没有必要知道,Borland把该做的都做了。
>>不可能知道,代码都在midas.dll中呵呵,将来我把它搞清楚告诉大家。最后真心谢谢chechy(我爱洁洁)!