• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 151
  • Last Modified:

Saving Database

How can i save my database without loosing some data's when my computer will accedentally turn off.

scenario:

 I created 5 new records (i call my procedure(SaveDatabase) to save the new datas). after a minute i created another new record and call again my procedure(SaveDatabase) to save that new data, then i tried to TURN OFF MY COMPUTER or pull-out the plug,(experimentation for BROWNOUTS),the result is this... When i browse my data again, it was all gone. whats wrong? how will i save my data into the harddisk making it permanent, even if my application hangs or shutdown accidentally, my new data STILL be there.

this is my procedure, whats wrong with this?

procedure TfBrowseForm.SaveDatabase(TheDatabaseTable:Twwtable);
begin
  if TheDatabaseTable.CachedUpdates then
  begin
   TheDatabaseTable.ApplyUpdates;
   TheDatabaseTable.CommitUpdates;
   DataModule1.refreshTables;
   TheDatabaseTable.UpdateIndexes;
  end
  else
  begin
   TheDatabaseTable.UpdateRecord;
   TheDatabaseTable.Post;
   DataModule1.refreshTables;
   TheDatabaseTable.UpdateIndexes;
  end;
end;


(DataModule1.refreshTables) this will only refresh the tables

0
ryan_sabarre
Asked:
ryan_sabarre
  • 2
1 Solution
 
ryan_sabarreAuthor Commented:
anybody can help me?
0
 
kretzschmarCommented:
use the dataset flushbuffers-method after each post,
respective after each applyupdates by enabled
cachedupdates

meikl ;-)
0
 
ryan_sabarreAuthor Commented:
Thank you so much Thank you so much Thank you so much Thank you so much Thank you so much Thank you so much
it really helps me a lot
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now