I am trying to update my database to have another column called Visible. I want the entire column to be filled with false values. When I run the code, it gets to the update function and kicks out the following error:
android.database.sqlite.SQLiteException: no such column: true: UPDATE Themes2 SET Visibility = true;
private static final String TABLE_THEMES_V2 = "Themes2";
public static final String KEY_VISIBLE = "Visibility";
if (oldVersion < 8) {
db.execSQL("ALTER TABLE " + TABLE_THEMES_V2 + " ADD COLUMN " + KEY_VISIBLE + " text");
db.execSQL("UPDATE " + TABLE_THEMES_V2 + " SET " + KEY_VISIBLE + " = true;");
db.setTransactionSuccessful();
}
Does anyone know what’s wrong? I used this same function a long time ago to input “1”s in the columns…
Your KEY_VISIBLE column is having Text data-type so you should update it with following syntax,
You are just missing
'single inverted mark in String value.The alternate way you can try is as follows, by making your KEY_VISIBLE column to integer type