Re: Saving last entries from the form

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



<gq_uan@xxxxxxxxxxx> wrote in message news:1176069446.652576.202400@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Is there a way to save the last entries from a form? Lets say for
some reason the power goes out, or the program crashed or
something irregular happens and the information on the form
needs to be restored back onto the form as soon as it's opened
again. How would I go about doing this?

You need to periodically save anything that is important. Unless your system has some sort of UPS then when the power goes it just, well, goes and by then it is too late to do anything at all. Regular saving of important data is the key. If the system on which your code is running has a UPS then I think there will be ways of "picking up" the fact that there is a power outage, so that your program can then specifically save all of its data and perform a graceful shutdown before the UPS runs out of steam. I've never dealt with UPS stuff so I'm not sure on that point, but it's something you might like to look into. It is possible (quite probable, I imagine) that the UPS software will trigger a shutdown of all applications. If that is the case then it will cause your application to close and all your Forms to unload, so you could probably deal with it in your main Form's QueryUnload or Unload event (if your app actually has a Form). But basically, for something that will be reasonably reliable on all systems, whether they have a UPS or not, regular saving of important data to a disk file is the key. It might also be worth saving to alternate disk files on each occasion, so that a power outage on an unprotected system that occurs in the middle of a write access to a file has much lower chance of destroying the data (because the previous "incarnation" of the saved data will still be available next time the system starts up). There are probably people here who have experience of such things who will give you more detailed (and probably much better) advice, but those are my initial thoughts on something which I admittedly do not have any experience with.

Mike


.



Relevant Pages

  • Re: "Mysterious" system crashes
    ... did when I took electronics and worked in that trade before getting ... made to appear as a capacitive load and the power company may give you ... little to the home-computer UPS buyer other than when he's trying to ... and offer some protection for less than $600. ...
    (comp.os.vms)
  • Re: back-up power supply
    ... :I was thinking to get a back-up power supply for my PC and saw a book ... The least expensive type of UPS is 'passive'. ... the battery goes back out again when the power returns. ... One issue with passive UPSs is that the electricity is not flowing ...
    (comp.security.misc)
  • Re: UPS waveform question for SUN servers
    ... O.K. The pure sine wave is better for systems with input ... The SB-1K and SB-2K use the same power supply. ... this UPS has caused more trouble than ... it has alleviated - with the battery sometimes discharging for no ...
    (comp.sys.sun.hardware)
  • Re: [PATCH 3/8] Universal power supply class (was: battery class)
    ... How about dumb DC power? ... Any reason to distinguish it from AC? ... Anyway, what IS the difference between UPS and battery, or UPS and AC/DC for ... "One disk to rule them all, ...
    (Linux-Kernel)
  • Re: Nut and RAID on FreeBSD 7.0
    ... >> power goes out for more than say 5 minutes or so. ... >> system goes into a safe state when the battery gets low, then the ups ... >> The second question has to do with a rc.d script that nut recommends ... The script does a 'upsdrvctl shutdown' and then a sleep ...
    (freebsd-questions)