Page 1 of 1

TvirtualTable260 savetofile question

Posted: Thu 10 Oct 2019 17:37
by dpap
I use virtualtable to manage some data and save them to a file. Saving/loading file works ok except in one case.
If i delete a field from the table and then save it, when i load it again sows the deleted field (in a DBgrid) without the values.
But i don't want the deleted field at all!
Here is a code snipet i use
// table.Fields[j].free;
table.Fields[j].DisposeOf;
.....
table.SaveToFile(filename);

What's wrong, please ?

Re: TvirtualTable260 savetofile question

Posted: Mon 11 Nov 2019 15:36
by MaximG
We've tested this behavior using the following code snippet and received the correct results.

Code: Select all

    ...
    var Field: TField;
    ...
    Field := VirtualTable.Fields[j];
    if Field <> nil then
      VirtualTable.DeleteField(Field.FieldName);
    VirtualTable.SaveToFile(filename);
    ...
Please try replicating it in your environment.