Loading/Saving DAMemDataTable to binary

Hello everyone,

I have a TDAMemDatatable which I want to save to a binary field and later load into another TDAMemDatatable. I use the remoteDataAdapter.Fill method to load the datatable.

I have built a class inheriting from the TROComplex type with a binary field declared.

At some point in my app I want to load the whole state of the DAMemDatatable (records, state, etc.) into the binary field later I want to be able to load a different DAMemDatatable from the binary field leaving it as if it were the same Datatable.

The first part works fine.

if cdsSearch.RecordCount > 0 then begin
   fLoader.ActiveFrameState.StateSaved := True;

cdsSearch: Datatable;
fLoader.ActiveFrameState.CDS: Binary;

When I try to load the DAMemDatatable from the Binary.

if fLoader.ActiveFrameState.CDS <> nil then begin

I get the error…

Incompatible Binary2Adapter Stream



Check that cdsSearch.RemoteDataAdapter.DataStreamer has the same type when you do cdsSearch.SavetoStream and cdsSearch.LoadFromStream.

also check that CDS.Position is set to 0 before loading/saving.