Is this a bug ?

I managed to get into this situation when connecting to a sqlite DB… (please look at the pic)

Error = False
ErrorCode = 1

Is this an ‘as expected’ behavior ?

Have you connected to the database with db.Connect?

That’s the error I get right after .createdatabasefile returns true… So I guess I should be connected

try to connect the db even after the createdatabasefile method.

Maybe it is the system you’re on but, in your photo, the DatabaseFile item looks odd to me. Are you sure that’s a valid file?

Please post your code here.

Dim asyncbckp as boolean = True

app.BackingUpNow = True

Dim backupFile As Folderitem

backupFile = GetFolderItem(app.UbicacionBackup+“HotelDB.bak”)

If backupFile Is Nil Then
app.BackingUpNow = False

app.BackupDB = New SQLiteDatabase
app.BackupDB.DatabaseFile = backupFile

dim ok as Boolean = app.BackupDB.Connect

If app.BackupDB.CreateDatabaseFile Then

if app.BackupDB.Error then 

app.BackupHandler1 = New BackupHandler

if asyncbckp = false then
SQLiteDatabase(app.HotelDB).BackUp(app.BackupDB, nil, -1) // SYNC
app.BackingUpNow = False
SQLiteDatabase(app.HotelDB).BackUp(app.BackupDB, app.BackupHandler1, 10) // ASYNC


app.BackingUpNow = False

End If


@Dale Arends Yep, Dale… it is a valid file…

First off, if on the first run-through, if the .bak file doesn’t already exist, the connect will generate an error that the file doesn’t exist. Subsequent runs should be ok.

I think a better approach is to check and see if the file exists and then do a connect if it does or a createdatabasefile if it doesn’t. The Create step will also connect if the create succeeds.

Remove this line of code:

dim ok as Boolean = app.BackupDB.Connect

Read and you’ll find that if the database already exists the method acts like the Connect method.

Even better. Remove:

dim ok as Boolean = app.BackupDB.Connect

And then Replace:

If app.BackupDB.CreateDatabaseFile Then


If app.BackupDB.Connect Then