I can't create the file in my image directory!

Hello everyone,
I’m trying to modify the code of the SQLite example (web)
On the first line I want to create the database in my images directory where I already have a “DIAPORAMA” directory.
The code below gives me the following error
There is more than one method with this name but this does not match any of the available signatures

Var dbFile As New FolderItem("example.sqlite", SpecialFolder.Pictures.Child("DIAPORAMA"))

If dbFile <> Nil And dbFile.Exists Then
  dbFile.Remove
End If

mDb = New SQLiteDatabase
mDb.DatabaseFile = dbFile

Try
  mDb.CreateDatabase
Catch err as DatabaseException
  mIsConnected = False
  CreateStatusLabel.Text = "Error creating SQLite database: " + err.Message
  Return
End Try

mIsConnected = True
CreateStatusLabel.Text = "Created SQLite database."

I guess the error is on the first line, right?
The error is telling you that the method (FolderItem) can’t handle what you put between ().
Check the docs for FolderItem and SpecialFolder

You are trying to use FolderItem method like this FolderItem(String, FolderItem) and there is no signature like that.

The sqlite (web) demo uses FolderItem(String, PathMode)

Hint: you have the SpecialFolder right up to the folder, you just need to use Child for the file inside the folder and the result is a FolderItem

1 Like

Here is the correct code,
Thank you for your clarification.

Var dbFile As New FolderItem( SpecialFolder.Pictures.Child("DIAPORAMA").Child("example.sqlite"))
1 Like

You really don’t need the “New FolderItem” piece of that.

Var dbFile As FolderItem = SpecialFolder.Pictures.Child(“DIAPORAMA”).Child(“example.sqlite”)

1 Like

The New is needed if you construct within the paréntesis.
If you don’t want to use the New you need to use =
The same as other commands.

1 Like