To update a value in my SQLite database (android) I use following method. The table is calles objects, the field I want to update is showinfo1, of a specific item with a certain id and level.
public void insertString(int id, int level, String field, String value){
myDataBase.execSQL("UPDATE OBJECTS SET " + field + "=" + value + " WHERE _ID=" + id + " AND LEVEL =" + level);
}
I have an error which I think is strange. It says there is ‘nosuchcolumn’ while there actually is one..:
android.database.sqlite.SQLiteException: no such column: true: UPDATE OBJECTS set showinfo1=true WHERE _ID=6 AND LEVEL =1
Any ideas how to solve this? Maybe my query is wrong?
your query should be like this
your string is translating to
UPDATE OBJECTS SET URFIELD = true ...and it is searching for the column namedtrue, so it should beURFIELD = 'true'(same goes forIDandLEVELif they weretext)