If you are using a local database (i.e. dBase or Paradox) then you probably ale have the BDE setting “LOCAL SHARE” set to false, which does not save changes to databases after they are modified immediately. The changes are kept in memory and saved later. In other words - cached.
This usually helps speed up database modifications because you don’t have a physical write after each and every change.
The problem may occur when your application (or Microsoft Windows itself
) crash. That’s when you know that your changes are gone forever. To work around this just save the database after every posting. Just add code to your TTable’s AfterPost property.
uses BDE; ... procedure TForm1.Table1AfterPost(DataSet: TDataSet); begin DbiSaveChanges(Table1.Handle); end;
Tags: borland, code, corruption, data, database, db, Delphi, freeware, loss, open source, prevent, prevetion, save, source, source code, tip, trick
Merlin’s Delphi Forge
Leave a comment