I am trying to create a generalized method that I can pass my database name to through a parameter e.g (opendb(“urldb.sqlite”)
When I run the following code I get the error message that says the file cant be found at the specified location. Can anyon tellme what I am doing wrong?
Dim dbFile As FolderItem = SpecialFolder.Desktop.Child(“dbame”)
Dim db As New SQLiteDatabase
dbFile = GetFolderItem(“dbname”)
db.DatabaseFile = dbFile
If db.Connect Then
//proceed with database operations here.
Else
MsgBox("The database couldn’t be opened. Error: " + db.ErrorMessage)
[code]Dim dbFile As FolderItem = SpecialFolder.Desktop.Child(“dbame”)
Dim db As New SQLiteDatabase
dbFile = GetFolderItem(“dbname”)
db.DatabaseFile = dbFile
If db.Connect Then
//proceed with database operations here.
Else
MsgBox("The database couldn’t be opened. Error: " + db.ErrorMessage)
End If[/code]
In the first line you get the file “dbname” from specialfolder.Desktop, two lines later to overwrite this with applicationfolder/dbname. Delete line 3 & try again.
From what you are saying, it sounds like dbname is the variable you are passing to this method, and not the actual file name. If so, it shouldn’t be in quotes.
Dim dbFile As FolderItem = SpecialFolder.Desktop.Child(dbame)