在服务端设立主从表,客户端更新操作,
try
dm.Client1.applyupdates(0);
Application.MessageBox('恭喜您,数据保存成功','操作提示',MB_OK + MB_ICONINFORMATION);
except
Application.MessageBox('对不起,更新失败既将回复','操作提示',MB_OK + MB_ICONINFORMATION);
dm.Client1.CancelUpdates;
end;
出了怪问题,提示数据保存成功,可没有更新数据庫。问题出在服务端进行库存量更新上,库存量表更新了,可主从表没有更新,DeltaDS客户端就是客户端的TClientDataSet主从数据集,从jin_shul,jin_bm 从客户端传
回的从表数据,问题就出在这里,shul,bm 是从表字段,客户諯reconcile error对话框提示找不到shul字段,
jin_shul := DeltaDS.FieldByName('shul').Asinteger;
jin_bm := DeltaDS.FieldByName('bm').AsString;procedure Tjingxiao.DataSetProvider1BeforeUpdateRecord(Sender: TObject;
SourceDS: TDataSet; DeltaDS: TCustomClientDataSet;
UpdateKind: TUpdateKind; var Applied: Boolean); jin_shul := DeltaDS.FieldByName('shul').Asinteger;
jin_bm := DeltaDS.FieldByName('bm').AsString; with kclspsql do
begin
Try
SQLText := 'update spk set kcl=kcl+"'+inttostr(jin_shul)+'" where bm="'+jin_bm+'"';
Close;
SQL.Clear;
SQL.Add(SQLText);
Except
exit;
end;
如何取客户端从表数据,在服务端进行库存量更新,各位帮忙阿!
try
dm.Client1.applyupdates(0);
Application.MessageBox('恭喜您,数据保存成功','操作提示',MB_OK + MB_ICONINFORMATION);
except
Application.MessageBox('对不起,更新失败既将回复','操作提示',MB_OK + MB_ICONINFORMATION);
dm.Client1.CancelUpdates;
end;
出了怪问题,提示数据保存成功,可没有更新数据庫。问题出在服务端进行库存量更新上,库存量表更新了,可主从表没有更新,DeltaDS客户端就是客户端的TClientDataSet主从数据集,从jin_shul,jin_bm 从客户端传
回的从表数据,问题就出在这里,shul,bm 是从表字段,客户諯reconcile error对话框提示找不到shul字段,
jin_shul := DeltaDS.FieldByName('shul').Asinteger;
jin_bm := DeltaDS.FieldByName('bm').AsString;procedure Tjingxiao.DataSetProvider1BeforeUpdateRecord(Sender: TObject;
SourceDS: TDataSet; DeltaDS: TCustomClientDataSet;
UpdateKind: TUpdateKind; var Applied: Boolean); jin_shul := DeltaDS.FieldByName('shul').Asinteger;
jin_bm := DeltaDS.FieldByName('bm').AsString; with kclspsql do
begin
Try
SQLText := 'update spk set kcl=kcl+"'+inttostr(jin_shul)+'" where bm="'+jin_bm+'"';
Close;
SQL.Clear;
SQL.Add(SQLText);
Except
exit;
end;
如何取客户端从表数据,在服务端进行库存量更新,各位帮忙阿!
No.2:在服务器端用UpdateDataSet.
对于这个,你再将另一个数据集信息进行处理一下, 主表、从表的都需要进行处理,而更新只有一个表成功的可能性也许是你的数据建的不是很好,关系没有进行具体的对应,此为一,另一种就是你进行关系的对应时,进行了强制的约束。还有,你在BeforeUpdateRecord里Exit不太好。
Application.MessageBox('对不起,更新失败既将回复','操作提示',MB_OK + MB_ICONINFORMATION)
else
Application.MessageBox('恭喜您,数据保存成功','操作提示',MB_OK + MB_ICONINFORMATION);
用个例子,可能对你有用