In a simple tcp/ip based datasnap application I am trying to send ClientDataSet from Client application to server similar to below example. Problem is that at server I am getting 1 less record than what I am sending from client. Any suggestion what is going on here? Thank You.
In a simple tcp/ip based datasnap application I am trying to send ClientDataSet from Client application to server similar to below example. Problem is that at server I am getting 1 less record than what I am sending from client. Any suggestion what is going on here? Thank You.
Client Code
-----------------------------------------
var
cd: TClientDataSet;
begin
cd:= TClientDataSet.Create(self);
cd.Data := cdsCustomer.Data;
Memo1.Lines.Add(IntTostr( cd.RecordCount )) ;
ServerMethods1Client.TestDataSet( CD);
Server Code
-------------------
function TServerMethods1.TestDataSet(ds: tdataset): string;
begin
try
DataSetProviderCommon.DataSet := ds;
if not DataSetProviderCommon.DataSet.eof then
TempClientDataSet.Open;
if TempClientDataSet.RecordCount >0 then
Form1.Memo1.Lines.Add( IntTostr( TempClientDataSet.RecordCount) )
else
Form1.Memo1.Lines.Add( ' Not records found' ) ;
DataSetProviderCommon.DataSet.Close;
except on e: Exception do
Form1.Memo1.Lines.Add('TestDataSet error :' + e.Message ) ;
end;
end;
Client Code
-----------------------------------------
var
cd: TClientDataSet;
begin
cd:= TClientDataSet.Create(self);
cd.Data := cdsCustomer.Data;
Memo1.Lines.Add(IntTostr( cd.RecordCount )) ;
ServerMethods1Client.TestDataSet( CD);
Server Code
-------------------
function TServerMethods1.TestDataSet(ds: tdataset): string;
begin
try
DataSetProviderCommon.DataSet := ds;
if not DataSetProviderCommon.DataSet.eof then
TempClientDataSet.Open;
if TempClientDataSet.RecordCount >0 then
Form1.Memo1.Lines.Add( IntTostr( TempClientDataSet.RecordCount) )
else
Form1.Memo1.Lines.Add( ' Not records found' ) ;
DataSetProviderCommon.DataSet.Close;
except on e: Exception do
Form1.Memo1.Lines.Add('TestDataSet error :' + e.Message ) ;
end;
end;
Comments
Post a Comment