It is failing because you have changed the behavior and didn’t account for the changes. By changing it to point to a folder, the later Delete code cannot work because the folder is not empty. Perhaps you want to point to a DB file within the folder?
if there is no sqllite file in the Temporary folder, and you want one there, you either need to put one there before you start,
OR
use CreateDatabaseFile to create one.
if you dont do the create, there is no file to open.
The docs have this:
Var dbFile As FolderItem
dbFile = SpecialFolder.ApplicationData.Child(“MyDatabase.sqlite”)
// DB As SQLiteDatabase is a property on the App object
App.DB = New SQLiteDatabase
App.DB.DatabaseFile = dbFile
If App.DB.CreateDatabaseFile Then
// Use the database
End If
For your purposes:
Var dbFile As FolderItem = SpecialFolder.Desktop.Child(“Temporary”).child(“mydatabase.sqllite”)
var thedb as New SQLiteDatabase
thedb.databasefile = dbFile
if dbfile <> nil and dbfile.exists then
//open and use the db
else
If thedb.CreateDatabaseFile Then
// Use the database
else
//problem
End If
end if