Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why will Table posting work fine, but changes not save to disk?

Status
Not open for further replies.

TimV

IS-IT--Management
Mar 28, 2002
21
US
I'm using Delphi 4, have a very simple single user database running, consisting of only 1 DataSource component, and 1 table component.

New entries, edits, & deletes all show up fine when I display the table. The problem is: These changes do not get written to the hard disk until I actually close the database.

This is driving me crazy, since any time the computer loses power or (I swear it wasn't me) get's turned off incorrectly, I lose all of the changes that were made since the last correct closing of the database. This program runs all the time, and doesn't normally ever get closed.

What can I do to force these changes to be written to disk?

 
hi,

If you use the BDE then you have to flush the buffers from the BDE.
Include BDE in the uses file and then implement after the POST on the table the next command:

DbiSaveChanges

example:
procedure TForm1.Table1AfterPost(DataSet: TDataSet);
begin
DbiSaveChanges(Table1.handle);
end;

Steph [Bigglasses]

 
Steph,

Thanks for the quick reply. I included BDE in the uses, am making use of the "AfterPost" event in table1:

procedure TForm1.Table1AfterPost(DataSet: TDataSet);
begin
DbiSaveChanges(Table1.handle);
end;

...and even added a "showmessage" line to see if the DbiSaveChanges line was executing. I get the message confirming the DbiSavechanges, but the database files do not get updated on the hard disk (I'm checking the access date/time from windows). If I close the database, the file date/time immediately updates to the time I closed the database.

The BDE idea still sounds good, but am I overlooking something else?

Thanks,
Tim
 
hi,

The date and time are updated on closing the database not on every writing event. If you want to see the date and time change close and open the database after the post.
An alternative is to start using queries. You donn't have to open the database and the date and time are changed directly after the execute os a query and the information is directly writen to disk.

Steph [Bigglasses]
 
I love this forum.

Thanks Steph!

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top