请问怎样批量保存ClientDataSet传给服务端的数据呀?
我在服客户端把数据写在ClientDataSet然后Post。
保存时用ClientDataSet.ApplyUpdates(0)保存出错,而且查不出错在哪里,我想自已把对ClientDataSet的改动提交到服务端然后自已对其进行数据库的更新,但是也出错,兄弟们指教一下错在哪里,有没有更好的方法?
我的代码如下:
----------客户端------------------------------
procedure TForm1.Button1Click(Sender: TObject);
var
ErrorCount: integer;
begin
ErrorCount := SocketConnection1.AppServer.PostDelta('DataSetProvider1',ClientDataSet1.Delta);//PostDelta是我在服务端写的一个方法,用来提交客户端传过来的修改日志
if ErrorCount > 0 then
showmessage('共出现[' + InttoStr(ErrorCount) + ']条错误!');
end;
----------------------------------------------
----------服务端------------------------------
//PostDelta是我在服务端写的一个方法,用来提交客户端传过来的修改日志
function TPostClientDataSetDelta.PostDelta(AQueryName,
ClientDataSetDelta: OleVariant): OleVariant;
var
ErrorCount: integer;
begin
Result := 0;
ErrorCount := 0;
if FindComponent(AQueryName) = nil then exit;
with (FindComponent(AQueryName) as TDataSetProvider) do
begin
ApplyUpdates(ClientDataSetDelta,0,ErrorCount);
Result := ErrorCount;
end;
end;
----------------------------------------------
请大家指出为什么会出错,谢谢!