I wanna copy created TXDBGrid
a full structure (columns) whith exist data in this Grid to kbmMemTable
.
All TDBGrid
descendant and similar components are a "visualization" of a data set, represented by a TDataset
descendant component (TTable
, TQuery
,...). TDBGrid
it's a way to represent data.
You can't build the structure in a kbmMemTable
from TDBGrid
, yes from TDataset
associated with that grid.
The component kbmMemTable
has this method:
procedure LoadFromDataSet(Source:TDataSet;
CopyOptions:TkbmMemTableCopyTableOptions);
{$IFDEF BCB}dynamic{$ELSE}virtual{$ENDIF};
The source parameter is the TDataset
associated to your grid, and the second parameter include options to copy the structure of source TDataset
(mtcpoStructure
).
TkbmMemTableCopyTableOption =
mtcpoStructure,mtcpoOnlyActiveFields,mtcpoProperties,
mtcpoLookup,mtcpoCalculated,mtcpoAppend,mtcpoFieldIndex,
mtcpoDontDisableIndexes,mtcpoIgnoreErrors
{$IFDEF LEVEL6},mtcpoStringAsWideString,mtcpoWideStringUTF8{$ENDIF});
Try some like this:
kbmMemTable1.LoadFromDataSet(XDBGrid1.Datasource.DataSet, [mtcpoStructure]);