|
I just wrote it and sent it to you, it works, language: delphi
Backup:
var
path: string; // The variable that stores the backup path
begin
path: = trim (ExtractFilePath (Application.ExeName)) + 'Database backup\' + 'db2.mdb';
try
if path <> '' then
begin
copyfile (pchar ('db1.mdb'), pchar (path), true);
application.MessageBox (pchar ('Backup successful!' + # 13), 'XGY', mb_ok + mb_iconinformation);
end;
except
begin
application.MessageBox (pchar ('Backup failed!' + # 13), 'XGY', mb_ok + mb_iconwarning);
abort;
end;
reduction:
var
dbname, dbbname: string;
begin
if MessageBox (self.Handle, 'Are you sure you want to restore the data?', 'Prompt', mb_IconQuestion + mb_YesNo) = idYes then
begin
dbname: = ExtractFilePath (Application.ExeName) + 'Database backup\' + 'db2.mdb';
dbbname: = ExtractFilePath (Application.ExeName) + 'New folder\' + 'db1.mdb';
if not FileExists (dbname) then
MessageBox (self.Handle, 'No backup data, cannot be restored', 'Prompt', mb_IconInformation + mb_Ok)
else
begin
CopyFile (Pchar (dbname), Pchar (dbbname), true);
MessageBox (handle, 'Database restored successfully!', 'Prompt', mb_IconInformation + mb_Ok);
end;
end;
end; |
|