Solved

Force write to database

Posted on 1998-11-10
11
224 Views
Last Modified: 2010-04-04
I save data in a paradox database using TTable. If the app crashes instead of normally shutting down, my changes to the database are lost. Is there any way to force the database files to update? Please don't respond with CommitUpdates or FlushBuffers. If you have an answer, test it to make sure it  works because I've tried alot of different methods and all failed.
0
Comment
Question by:agenthex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 

Expert Comment

by:john_m
ID: 1346435
Note that you may have tried telling the BDE to save the buffers (something like DbiSaveChanges or something), but under certain operating systems, the process of writing any data to disk may be cached. This is especially the case with NT. Take a look at the Win32 API...


0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1346436
hi agenthex,

the easiest way is to close and reopen your table, but it sucks perfomance.

meikl
0
 

Author Comment

by:agenthex
ID: 1346437
meikl,
   actually I already do close and reopen the TTable. It doesn't work :/ I'm thinking it may be the fault of the database-aware controls.

agenthex
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 27

Expert Comment

by:kretzschmar
ID: 1346438
hi agenthex,

then i think john_m has right because OS has cached the information, and you must force the OS to write back on hd. If your table local or on a network?

meikl
0
 
LVL 2

Accepted Solution

by:
SupWang earned 50 total points
ID: 1346439
hi, agenthex

Add the BDE declared in your uses section. and use the function: DBISaveChanges(yourTable1.Handle); That will write the data to real the database.

regards,
SupWang
0
 
LVL 2

Expert Comment

by:SupWang
ID: 1346440
notice: the BDE declared will cause the Abort procedure could not be compile. The error message is : Statement expected, but expression of type 'Integer' found. (Delphi 3)
use SysUtils.Abort instead Abort.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1346441
hi supwang,

you are fast with your answers, but see john_m comment.

meikl
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1346442
hi supwang, hi agenthex,

i have take a look to the compentsources(D3). the method flushbuffers use the dbisavechanges-function. so it seems dbisavechanges is not the solution for your problem. there is an win32 api call :

FlushFileBuffer(FileHandle)

FileHandle could be the tablehandle (not tested out yet)

meikl
0
 
LVL 2

Expert Comment

by:SupWang
ID: 1346443
How can I take a look to the compentsources?
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1346444
hi supwang,

you must have the Delphi C/S Edition (all componentSources included)!

meikl
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1346445
Also set LOCALSHARE to true.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month10 days, 13 hours left to enroll

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question