whsunbin 将中间层DataSetProvider控件的poPropogateChange属性改为True还是不行,帮忙看看程序
procedure TagentserverRDM.dspGetXingyeBeforeUpdateRecord(Sender: TObject;
SourceDS: TDataSet;
DeltaDS: TCustomClientDataSet;
UpdateKind: TUpdateKind;
var Applied: Boolean);
begin
if UpdateKind =Ukinsert then
begin
deltaDs.Edit;
deltaDs.FieldByName('Postdate').Value :=now;
deltaDs.FieldByName('id').Value :=11111;
deltaDs.post;
end;
UpdateXingye(DeltaDS, UpdateKind);
Applied:=true;
end;
procedure TagentserverRDM.UpdateXingye(DeltaDS: TCustomClientDataSet;
UpdateKind: TUpdateKind);
begin
case UpdateKind of
ukInsert: //增加
begin
AssignFieldValue(DeltaDS, spXingyeInsert, 'Id', '@id');
AssignFieldValue(DeltaDS, spXingyeInsert, 'PostDate', '@postdate');
AssignFieldValue(DeltaDS, spXingyeInsert, 'Title', '@Title');
AssignFieldValue(DeltaDS, spXingyeInsert, 'content', '@content');
AssignFieldValue(DeltaDS, spXingyeInsert, 'origin', '@origin');
AssignFieldValue(DeltaDS, spXingyeInsert, 'from_url', '@from_url');
spXingyeInsert.ExecProc;
end;
ukModify : //修改
begin
AssignFieldValue(DeltaDS, spXingyeEdit, 'Title', '@Title');
AssignFieldValue(DeltaDS, spXingyeEdit, 'content', '@content');
AssignFieldValue(DeltaDS, spXingyeEdit, 'origin', '@origin');
AssignFieldValue(DeltaDS, spXingyeEdit, 'from_url', '@from_url');
spXingyeEdit.ExecProc;
end;
ukDelete : //删除
begin
spXingyeDelete.Parameters.ParamByName('@ID').Value := DeltaDS.FieldByName('Id').Asstring;
spXingyeDelete.ExecProc;
end;
end;
end;
procedure TagentserverRDM.AssignFieldValue(DeltaDS: TCustomClientDataSet;
adostore : TADOStoredProc;
const sField, sID : string);
var
aField : TField;
Value: Variant;
begin
aField := DeltaDS.FieldByName(sField);
Value := aField.NewValue;
if VarIsEmpty(Value) then
adostore.Parameters.ParamByName(sID).Value := aField.OldValue
else
adostore.Parameters.ParamByName(sID).Value := Value;
end;
结果在客户端还是没有得到id和postdate,拜托大家了