Re: Backing up

[ DelphiLand FAQ ]

Posted by webmaster Guido on March 25, 2003

In Reply to: Backing up posted by ste d on March 25, 2003:

: My program needs a backup and restore option wherby the database is copied either to floppy or hardisk. Iv got it to copy the program alright but need it so if any changes are made to the database, the user can click restore, it replaces the current database with the old database. At the moment im using this code to back up:

: copyfile('H:\computing\A2\Major Project\Driving School\DrivingDB1.mdb','H:\computing\A2\Major Project\Driving School\backupdatabase.mdb',false);

: and this to restore but the restore doesnt work

: copyfile('H:\computing\A2\Major Project\Driving School\backupdatabase.mdb','H:\computing\A2\Major Project\Driving School\DrivingDB1.mdb',false);

: any suggestions???

Just a couple of ideas:

1. Make sure that the database file is not in use before you restore it, i.e. close it before trying to overwrite it with the backup. After the restore operation, open it again.

2. Make sure that the file DrivingDB1.mdb is not read-only (test it by manually trying a restore Windows Explorer, when your Delphi program is not running).

Related Articles and Replies:

[ DelphiLand Forum ]