【发布时间】:2018-09-13 14:32:46
【问题描述】:
我使用 TClientDataSet 来存储一些本地数据,通过使用 'savetofile' 方法。
我注意到当我使用下面的代码时:
// at this point the file myfile.cds has 3000 records and 130 kbytes.
myClientDataSet.loadfromfile('myfile.cds');
myClientDataSet.emptydataset;
myClientDataSet.savetofile('myfile.cds');
// at this point the file myfile.cds has no records anymore, but still has the same size, 130kb !
似乎'emptydataset'方法会删除所有记录,但是当我保存到文件时,文件大小仍然保持不变!如何真正擦除所有数据和文件大小?
谢谢
【问题讨论】:
-
我无法重现所描述的行为。
-
myClientDataSet.ApplyUpdates?
-
注意表结构还是要写的。