Topic: Backup

Hi.
As script can be copied to another file sqlite.db subfolder?
Like a backup and go overwriting the existing subfolder sqlite.db.
Thanks again.

Re: Backup

Hello,


if the file sqlite.db in the project folder, also you should create folder "Backup"

procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
begin
   CopyFile('sqlite.db', 'Backup\sqlite.db');
end;
Dmitry.

Re: Backup

Thanks for the reply, but it does not work.
An error that says - undeclared identifier: 'CopyFile'.

Re: Backup

Please, download latest version 1.45
http://myvisualdatabase.com/download/myvisualdb.exe

Dmitry.

Re: Backup

It Works.
Thank you

Re: Backup

Hi,
Indeed make a copy but if you click No in the dialog box then still MVDB create a copy? See script below.

procedure Form1_btBackup_OnClick (Sender: string; var Cancel: boolean);
begin
          if 7 = MessageDlg('Create / Update the SqLiteDB? Best choice is every day on the end of the shift back it up.', mtConfirmation, mbYes + mbNo, 0) then
          Cancel := True;
          CopyFile('sqlite.db', 'Backup\sqlite.db'); // Application path
       //   CopyFile('sqlite.db', 'I:\TP2014\Backup\sqlite.db'); // Reserve path
       //   P:\C\CF\CF3\TEST GA en MB\TP2014\Backup\sqlite.db  // Backup path workplace
end;

Thanks

Re: Backup

carlo_dj

you forgot to write Begin and End after Then

procedure Form1_btBackup_OnClick (Sender: string; var Cancel: boolean);
begin
          if 7 = MessageDlg('Create / Update the SqLiteDB? Best choice is every day on the end of the shift back it up.', mtConfirmation, mbYes + mbNo, 0) then
          begin
                Cancel := True;  // I think it is not necessary
                CopyFile('sqlite.db', 'Backup\sqlite.db'); // Application path
                //CopyFile('sqlite.db', 'I:\TP2014\Backup\sqlite.db'); // Reserve path
                //P:\C\CF\CF3\TEST GA en MB\TP2014\Backup\sqlite.db  // Backup path workplace
          end;
end;
Dmitry.

Re: Backup

Hello,
Indeed you're right. copy works correctly now. But it works the other way around. No clicks is a copy and click Yes is no copy made?
Thanks

Re: Backup

Change if 7 = MessageDlg to if 6 = MessageDlg

Dmitry.

Re: Backup

6 = MessageDlg = correct, thanks

Re: Backup

Hello Dimitri

It works well with your script

But, how should be this script if I want to let users choose their own folder to realise this backup
I mean by way of function OpenDialog that could be created  on runing
with  TOpenDialog.Create(self); ?

Is it possible ?

Thanks for your answer

Jean B.