sqlite testings

Hey :slight_smile:

im trying to get an sqlite file connected, but something is wrong:

[code]If app.dbFile <> Nil And app.dbFile.Exists Then
app.sqliteDB = new SQLiteDatabase
app.sqliteDB.DatabaseFile = app.dbfile

    Dim sql as string = "select hash from user where username ='" + txt_user.text + "'"
    
    Dim data As RecordSet 
    data = app.sqliteDB.SQLSelect(sql)
    
    If app.sqliteDB.Error Then
      MsgBox("DB Error: " + app.sqliteDB.ErrorMessage)
      return
    End If

End If[/code]

the dbfile is binded at start:

dbfile = SpecialFolder.SharedApplicationData.Child("PKV-Manager").Child("pkvm_base.db")

But he thinks the db is closed…whats wrong here o.O?

you havent called Connect

Before you query, use Connect such as

if NOT app.dbFile.connect() Then
msgbox app.dbFile.errormessage
return
End if

hmm dont understand this…

app.sqliteDB
app.dbFile

both have no connect property?

oh ok seems like the IDE doesnt want to show it but

If Not app.sqliteDB.Connect Then MsgBox("DB Error: " + app.sqliteDB.ErrorMessage) return End If
seems to work

Connect is a method, not a property:

http://documentation.xojo.com/index.php/Database.Connect

Autocomplete is contextual. If a method like Connect returns a value and you type

app.sqlitedb.conn

autocomplete will not supply Connect as an option because it isn’t valid in this context. But if you type

if app.sqlitedb.conn

then autocomplete will show Connect as a valid option.