I’m having a problem with a Sqlite PreparedStatement UPDATE with a Popup Menu ppmPopupMenu populated with RowNm Column. I want to Select an Item and update it and with different text. It completes showing it was a successful update but it really failed and did not update. What in the code is wrong. do I have to put ID at the end not beginning of the Binds?
My code is long so I created a shorter example to what I’m doing.
[code]Dim RowID As Integer
Dim sql As String
sql = “UPDATE MyTable SET RowNm = ?, Col_1 = ?, Col_2 = ?, Col_3 = ?, Col_A = ?, Col_B = ?, Col_C = ? WHERE ID = ?”
Dim ps As SQLitePreparedStatement = db.Prepare(sql)
//Find Select Item ListIndex and Assign Integer to RowID
RowID = ppmPopupMenu.RowTag(ppmPopupMenu.ListIndex)
ps.BindType(0, SQLitePreparedStatement.SQLITE_INTEGER) 'ID
ps.BindType(1, SQLitePreparedStatement.SQLITE_TEXT) “RowNm”
ps.BindType(2, SQLitePreparedStatement.SQLITE_TEXT) 'Col_1
ps.BindType(3, SQLitePreparedStatement.SQLITE_TEXT) 'Col_2
ps.BindType(4, SQLitePreparedStatement.SQLITE_TEXT) 'Col_3
ps.BindType(5, SQLitePreparedStatement.SQLITE_TEXT) 'Col_A
ps.BindType(6, SQLitePreparedStatement.SQLITE_TEXT) 'Col_B
ps.BindType(7, SQLitePreparedStatement.SQLITE_TEXT) 'Col_C
ps.Bind(0, RowID)
ps.Bind(1, “MyRow”
ps.Bind(2, “Text1”)
ps.Bind(3, “Text2”)
ps.Bind(4, “Text3”)
ps.Bind(5, “TextA”)
ps.Bind(6, “TextB”)
ps.Bind(7, “TextC”)
ps.SQLExecute()
If Not db.Error Then
MsgBox"Preset Successfully Edited"
Else
MsgBox"Failed to Save Preset"
MsgBox("Error: " + Str(db.ErrorCode) + " - " + db.ErrorMessage)
End If[/code]