Hello,
I have the following SQLitePreparedStatement code to interfacing with my sqlitedatabase :
Dim stmt As SQLitePreparedStatement = Self.Prepare("SELECT PurchaseID, PurchaseDate, ItemID, TotalPrice, PurchaseLocation, Quantity FROM Purchases WHERE PurchaseID=?")
stmt.BindType(0, SQLitePreparedStatement.SQLITE_TEXT)
stmt.Bind(0, purchaseNum)
Dim rs As RecordSet = stmt.SQLSelect
If rs <> Nil Then
rs.Edit
rs.Field("PurchaseDate").DateValue = purchaseDate
rs.Field("Quantity").IntegerValue = Quantity
rs.Field("ItemID").IntegerValue = ItemID
rs.Field("TotalPrice").IntegerValue = TotalPrice
rs.Field("PurchaseLocation").IntegerValue = StoreName
rs.Update
rs.Close
End If
Return Not Self.Error
The problem is the rs always failed to grab the “stmt.SQLSelect” or probably both stmt failures on SQLSelect?, i am getting rs/record set out of range because rs is always empty when querying the Purchases table. Upon debugging the rs RecordSet are always empty (NIL).
This method parameters :
purchaseDate As Date, purchaseNum As String, quantity As Integer, ItemID As Integer, TotalPrice As Integer, StoreName As Integer
When querying manually on any SQLite DB Manager it working perfectly :
While debugging the method, purchaseNum is already grabbed from the values that are passed to this method :
Purchases table structure :