Prepared Statement problem

This routine worked fine in my original web app written in 2012R2.1. Updating to 2013r4.1 causes the data to not be written, but without causing a database error.

Sub SaveData(Items As String, ItemVals As String) dim rs As RecordSet = mySession.ConfigDB.SQLSelect("SELECT * FROM Setups WHERE Item = '" + Items + "'") dim sql As String if rs=nil or rs.EOF Then sql = "INSERT INTO Setups (Item, ItemVal) VALUES (?, ?)" Else 'rs.Edit 'rs.Field("ItemVal").StringValue = ItemVals 'rs.Update ''sql = "UPDATE Setups SET ItemVal = '" + ItemVals + "' WHERE Item = '" + Items + "'" ''mySession.ConfigDB.SQLExecute(sql) 'exit sub sql = "UPDATE Setups SET ItemVal = ? WHERE Item = ?" end if dim ps As SQLitePreparedStatement = mySession.ConfigDB.Prepare(sql) if mySession.ConfigDB.Error Then MsgBox mySession.ConfigDB.ErrorMessage ps.BindType(0, SQLitePreparedStatement.SQLITE_TEXT) ps.BindType(1, SQLitePreparedStatement.SQLITE_TEXT) ps.Bind(0, Items) ps.Bind(1, ItemVals) ps.SQLExecute() if mySession.ConfigDB.Error Then MsgBox mySession.ConfigDB.ErrorMessage End Sub
It updates properly with the commented out rs.edit ... rs.update and straight SQLExecute statement, but it does not work with the prepared statement. Neither the INSERT nor UPDATE statements work. Other prepared statements in the app work as expected, but not this one. I have retyped everything after the dim ps As thinking there may be hidden garbage.

You’re binding the values in reverse. Your prepared statement is essentially

update setups set ItemVal = Items where Item = ItemVals

Thanks, Tim. I spent hours looking for this.