delphitclientdatasettstringfield

Can TStringField be created with dynamic Size?


I have Insufficient memory error with TClientDataset with TStringField fields. I need to use length of strings from 0 to 8000 - but don't know what length will be until I fill the TClientDataset.

So, can TStringField be created with dynamic Size?

P.S. The initial task is to copy TDBGrid to TClientDataset.


Solution

  • I have used the following solution. First, calculate maximum Sizes based on Length(aDBGrid.Columns[i].Field.DisplayText). Then create TStringFields with the calculated Sizes.

    P.S. The initial task is to copy TDBGrid to TClientDataset.