hello every one ; using delphi 10.4.2
i need some help
im trying to backup a sqllite database like this :
var msg,CommonPath: string;
SourceFile: string;
BackupFile: string;
begin FireTaskList.connected := False;
SourceFile := TPath.combine(TPath.GetDocumentsPath,'tasks.s3db');// TPath.GetDocumentsPath +PathDelim+ 'tasks.s3db';
BackupFile := TPath.Combine( TPath.GetSharedPicturesPath, 'MyBackup.s3db');
if not FileExists(SourceFile) then Exit;
msg := 'Create a file in the following location ' + sLineBreak+
ExtractFilePath(BackupFile);
TDialogService.MessageDialog(
msg,
TMsgDlgType.mtConfirmation,
mbYesNo,
TMsgDlgBtn.mbYes,
0,
procedure(const AResult: TModalResult)
begin
if AResult=mrYes then begin
try
FDSQLiteBackup1.Database := SourceFile;
FDSQLiteBackup1.DestDatabase := BackupFile;
FDSQLiteBackup1.Backup;
ShowMessage( ExtractFileName(BackupFile)+' ...'+'saved' );
except
on E: Exception do begin
msg := E.ClassName + sLineBreak + E.Message;
ShowMessage( msg ); mmo1.text := BackupFile;
end;
end;
end;
end
);
end;
and im keep getting an error message
i did set the read and write permissions
and i connected the database like this
try
FireTaskList.Connected := False;
FireTaskList.Params.Clear;
FireTaskList.LoginPrompt := False;
FireTaskList.Params.Values['OpenMode'] :='=ReadWrite';
FireTaskList.Params.DriverID := 'SQLite';
FireTaskList.Params.Values['Database'] := TPath.combine(TPath.GetDocumentsPath,'tasks.s3db');
except
on E: EDatabaseError do
ShowMessag('cant connect' + E.Message);