Help with SQLitePreparedStatement

I don’t know why this SqlitePreparedStatement returns NIL
Dim ps As SQLitePreparedStatement
Dim auth1 As String = lb.Cell(row,0)
(typ is a string variable)

ps = SQLitePreparedStatement(App.DB_Library.Prepare("SELECT * FROM ANBio WHERE ANname = ? AND type = ? "))
ps.BindType(0, SQLitePreparedStatement.SQLITE_TEXT)
ps.BindType(1, SQLitePreparedStatement.SQLITE_TEXT)
ps.Bind(0, auth1)
ps.Bind(1, typ)
rs = ps.SQLSelect

but this works.
  
rs = App.DB_ANBio.SQLSelect("SELECT * FROM ANBio WHERE ANname = '" + auth1+ "' AND type = '"+typ+"' ")

I use SqlitePreparedStatement’s elsewhere in the app without problems.

You might try SQLdeLite which handles prepared statements for you: https://github.com/1701software/sqldelite

My guess is one of the string variables is empty?

You have App.DB_Library up top
And
App.DB_ANBio On the non prepared version

Could that be it?

Thank you Peter. Thats what happens when I paste code when I’m half asleep. I can’t believe I over looked the different DB’s.

If I had a dollar for every mistake I’ve made I’d have retired at birth :slight_smile:

Please check error state of database.
Maybe it has a text message for you?