Board index » delphi » Add Data to an Existing ClientDataSet

Add Data to an Existing ClientDataSet


2004-12-22 01:43:17 PM
delphi12
Hi,
Uses: Delphi+5, MS SQL Server 2000, ADO, WindowsXP;
The method "ClientDataSet1.Data" is possible to send data from one ClientDataSet to another, by assign'n as:
ClientDataSet2.Data := ClientDataSet1.Data;
My problem here is, is it possible to append the Data from one CDS to an another ClientDataSet, keeping the existing record as it is using the "Data" property/method of ClientDataSet.
Assume that CDS2 has some records in it(take it as 200 records), and CDS1 has 100 records. Is it possible to add the 100 records of CDS1 to CDS2, which makes the Total Records to 300 of CDS2.
Regards,
Hifni Shahzard
 
 

Re:Add Data to an Existing ClientDataSet

No. You will have to insert the records one by one.
--
Bill Todd (TeamB)
TeamB cannot answer questions received via email
Hifni Shahzard writes:
Quote
My problem here is, is it possible to append the Data from one CDS to
an another ClientDataSet, keeping the existing record as it is using
the "Data" property/method of ClientDataSet.
 

Re:Add Data to an Existing ClientDataSet

Hifni Shahzard writes:
Quote

Hi,
Uses: Delphi+5, MS SQL Server 2000, ADO, WindowsXP;

The method "ClientDataSet1.Data" is possible to send data from one
ClientDataSet to another, by assign'n as:

ClientDataSet2.Data := ClientDataSet1.Data;

My problem here is, is it possible to append the Data from one CDS to
an another ClientDataSet, keeping the existing record as it is using
the "Data" property/method of ClientDataSet.

Assume that CDS2 has some records in it(take it as 200 records), and
CDS1 has 100 records. Is it possible to add the 100 records of CDS1
to CDS2, which makes the Total Records to 300 of CDS2.

Regards,

Hifni Shahzard
Look at the help for AppendData. If is used internally when
PacketRecords <>-1. I have issues with ApplyUpdates to the appended
records though. The CDS fields have to be exactly the same.
cds1.AppendData(cds2.Data,true);
I have s{*word*99}ped useing this code in favor of this.
cds1.first;
while not cds1.eof do begin
cds2.Append;
for x := 0 to cds1.FieldCount - 1 do
cds2.Fields[x].Assign(cds1.Fields[x]);
cds2.Post;
cds1.next;
end;
cds2.MergeChangeLog;
 

Re:Add Data to an Existing ClientDataSet

Is there anyway to even to append record from a ".cds" or ".xml" file to an
physical Table via ClientDataSet?
There are some use the term "Synchronize" in the Multitier Environment. I
wonder what mechanism does it go through. I will be very pleased to dicuss
this topic with someone who had done "Synchronizing".
"Hifni Shahzard" <XXXX@XXXXX.COM>writes
Quote

Hi,
Uses: Delphi+5, MS SQL Server 2000, ADO, WindowsXP;

The method "ClientDataSet1.Data" is possible to send data from one
ClientDataSet to another, by assign'n as:

ClientDataSet2.Data := ClientDataSet1.Data;

My problem here is, is it possible to append the Data from one CDS to an
another ClientDataSet, keeping the existing record as it is using the
"Data" property/method of ClientDataSet.

Assume that CDS2 has some records in it(take it as 200 records), and CDS1
has 100 records. Is it possible to add the 100 records of CDS1 to CDS2,
which makes the Total Records to 300 of CDS2.

Regards,

Hifni Shahzard