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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Saving Problem

Status
Not open for further replies.

teknik

Programmer
Feb 27, 2001
33
IN
WE HAVE A APPLICATION IN VFP 6.0.
WE HAVE USED FREE TABLES IN THE APPLICATION

THE PROBLEM IS THAT IF THE APPLICATION IS PROPERLY CLOSED THEN THE DATA IS SAVED
BUT IF THE APPLICATION IS CLOSED ABNORMALLY(i.e. Shut dOWN OF Machine Etc.) THEN ALL THE DATA IS LOST AFTER THE LAST DATA SAVED (I.E. PROPER CLOSING OF THE APLICATION).

IS THERE IS SOME METHOD TO COMMIT IN BETWEEN THE TRANSACTIONS FOR THE FREE TABLES

PLEASE HELP !!!



 
It sounds as though the tables are being opened when the app starts and kept open until it closes. In this situation Fox will push data down to disk as and when it finds the time.

You could improve matters by opening tables when they're needed and closing them afterwards. That might take a bit of a rewrite so a quick fix would be to use the Flush command to force Fox to write data to disk.




Geoff Franklin
 
I've just read your message again and seen the word "TRANSACTION". Do you mean a transaction in the strict sense of an atomic save bounded by Begin Transaction and End Transaction? If so and you are holding transactions open for long periods then the app really does need a rewrite.

A pending transaction is held in memory and will stay there until the End Transaction or Rollback command. All transactions should be as short as possible with no user interaction whilst they are open.


Geoff Franklin
 
Teknik,

AlvechurchData has given you a very complete answer. I would just add that this problem is not specific to Visual FoxPro. In all applications, if you shut down abnormally, you risk losing data that was entered since the previous save. The best solution is to avoid an abnormal shutdown.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-consult.com)
 
Hi teknik,

Use UNLOCK, FLUSH OR TABLEUPDATE() to commit the changes. USE or CLOSE ALL could also work for you.

AlvechurchData: BEGIN/END TRANSACTION is only supported for tables in a database.

Regards,

Mike
 
teknik;

See the Fox Help topic for the ON SHUTDOWN command.

Ed

Please let me know if the suggestion(s) I provide are helpful to you.
Sometimes you're the windshield... Sometimes you're the bug.
smallbug.gif
 
Eguy,

See the Fox Help topic for the ON SHUTDOWN command

I don't think that would help. The problem was one of abnormal shutdown, in which case the ON SHUTDOWN command won't fire.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-consult.com)
 
Mike;

What you say is true. But if the user is trying to exit Windows without exiting the app then control would be returned to FoxPro and the ON SHUTDOWN would fire. If not then barring anything unusual i.e power failure etc, in my opinion user education is in order.

My $0.02

Ed


Please let me know if the suggestion(s) I provide are helpful to you.
Sometimes you're the windshield... Sometimes you're the bug.
smallbug.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top