Want to ask something, is it same to do this:

Want to ask something, is it same to do this:
cdsMaster.Data := cdsSource.Data, so far i know that doing that i will copy all the data of that clientdataset dan will cancel the transaction if it is currently in edit or insert mode. So is there anything else i should acknowledge? thanks

Comments

  1. This doesn't answer your question, but what is your reason for copying the data from one CDS to another?

    If you need to display the same data in another form without being tied to "current" record, you can easily just use a cloned cursor.

    cdsDest.CloneCursor(cdsSource, True);

    Basically, it allows each CDS to independently point to different records in the dataset but both ClientDataSets will access the same underlying data. A change in one CDS will also be seen in the other CDS and vice versa. In other words, there is only one copy of the data that is being shared between the two ClientDataSets.

    Not sure if this is any help but may be it can give you a different angle to whatever problem you are trying to solve.

    ReplyDelete
  2. Thanks for the answer, i've tried that solution too, but the clonecursor give me more problem, the behaviour that it will effect the source clientdataset data is not what i want to happen.
    I'm not using it to display the same data, but i'm using it to read the recordset and doing some operational with it that i don't want it to affect the source data, like doing an aggregate function, copying the data temporarily for other usage. Now that i mentioned doing aggregate function, i know that there is an aggregate field already, but it doesn't work as i want, because sometime it doesn't return a valid value on a certain condition that i need some time to investigate it more deeply.

    ReplyDelete

Post a Comment