views:

139

answers:

1

Hi guys.

The scenerios is like this:

We have some SQL table. We are perfroming an SQL query on this table and we have results in TADOQuery object.

var
  qryOryginal, qryClone: TADOQuery;

begin
  //setup all the things here
  qryOryginal.Active := True;
  qryClone.Clone(qryOryginal, ltBatchOptimistic);
  qryOryginal.Delete; //delete in qryOryginal casues that qryClone deletes its record too!
end;

So, after cloning the DataSet my qryClone should hold and independant data(atleast I thought so). However, performing Delete on qryOryginal causes the same operation on the qryClone. I don't want that.

Any ideas?

I know I could store the data elsewhere, in TClientDataSet perhaps but I would like to try the above solution first.

Thanks in advance for your time.

A: 

Cloning just clones the cursor on dataset, not duplicating the data kept in the dataset.

If you need to have two independent data, then you have to copy the data from the original dataset to the second one.

If you want to read or modify a single dataset without changing the current cursor on the dataset, then you can use Clone method.

vcldeveloper