I am attempting to set up a TFDBatchMove
object called FDBatchMove
with a reader and writer dataset. According to this documentation
An application should assign the required reader and writer to the properties, and then call the Execute method.
According to the documentation for TFDBatchMoveDataSetReader
one should
Use TFDBatchMoveDataSetReader to define the source dataset from which to load information using TFDBatchMove.
Set the DataSet property to select the dataset.
Choose the TFDBatchMoveDataSetReader as the Reader property of the TFDBatchMove.
The documentation for TFDBatchMoveDataSetWriter
contains the same steps.
Therefore, I have created a TFDBatchMoveDataSetReader
and a TFDBatchMoveDataSetWriter
object, and set their dataset values like so:
TFDBatchMoveDataSetReader * Reader = new TFDBatchMoveDataSetReader( this );
Reader->DataSet = MyDataSet1;
TFDBatchMoveDataSetReader * Writer = new TFDBatchMoveDataSetReader( this );
Writer->DataSet = MyDataSet2;
However, I run into an issue when I attempt to set the reader and writer property of my TFDBatchMove
object (i.e. the third step in the documentation).
The code...
FDBatchMove->Reader = Reader;
FDBatchMove->Writer = Writer;
...gives me the following errors:
E2034 Cannot convert 'TFDBatchMoveDataSetReader *' to '_di_IFDBatchMoveReader'
E2034 Cannot convert 'TFDBatchMoveDataSetWriter *' to '_di_IFDBatchMoveWriter'
I tried explicitly creating a new _di_IFDBatchMoveReader
object, however that object does not give me access to the Dataset property. How am I supposed to set up my TFDBatchMove
object with a dataset reader and dataset writer?
After looking at this delphi example I have figured out the solution. In order to apply the TFDBatchMoveDataSetReader
and TFDBatchMoveDataSetWriter
objects to a TFDBatchMove
object, you place the TFDBatchMove
object in their constructors as the owner parameter. So in my case, it would look like this:
TFDBatchMoveDataSetReader * Reader = new TFDBatchMoveDataSetReader( FDBatchMove );
TFDBatchMoveDataSetReader * Writer = new TFDBatchMoveDataSetReader( FDBatchMove );