Page 1 of 1

crBatchMove and EOF problem

Posted: Wed 21 Jul 2010 23:03
by ioda
Hi,

Thanks to resolve RecordCount problem in crBatchMove. After many tests, I found other problem when dataset property EOF is True and I want to copy the last row in other dataset.

This is the code to you need to reproduce problem

OldDataset.Last;

BatchMove.RecordCount := 1;
BatchMove.Source := OldDataset;
BatchMove.Destination := NewDataset;
BatchMove.Execute;

If you check in NewDataset, nothing row is copied. But, if you try OldDataset.Prior and OldDataset.Next before Execute, the row will be copied.

I hope you'll resolve this problem ?

Thanks

Posted: Thu 22 Jul 2010 15:34
by Dimon
We can't change this behaviour because this influences backward compatibility so these changes will affect many users. For example, if you execute records transferring in a loop, then in many cases the last record will be copied many times. Also there is no possibility to know the reason of setting the EOF property.

Posted: Thu 22 Jul 2010 16:30
by ioda
I understand what you wrote but, if I want to copy last record, how I can if I can't use DataSet.Last ?

Posted: Fri 23 Jul 2010 13:48
by Dimon
You can use the following code:
OldDataset.Last;
OldDataset.Prior;
OldDataset.Next;