I'm writing a method to update default settings in a table. The table is very simple: two columns, the first containing labels to indicate the type of setting, the second to store the value of the setting.
At this point in the execution, the table is empty. I'm just setting up the initial value. So, I expect that this cursor will come back empty. But instead, I'm getting an error (shown below). The setting that I am working with is called "lastPlayer" and is supposed to get stored in the "SETTING_COLUMN" in the "SETTINGS_TABLE". Here's the code:
public static void updateSetting(String setting, String newVal) { String table = "SETTINGS_TABLE"; String[] resultColumn = new String[] {VALUE_COLUMN}; String where = SETTING_COLUMN + "=" + setting; System.err.println(where); SQLiteDatabase db = godSimDBOpenHelper.getWritableDatabase(); Cursor cursor = db.query(table, resultColumn, where, null, null, null, null); System.err.println("cursor returned"); //I never see this ouput \\more } sqlite returned: error code = 1, msg = no such column: lastPlayer
Why is it saying that there is no such column lastPlayer? I thought that I was telling the query to look at the column "SETTING_COLUMN" and return the record where that column has a value "lastPlayer". I'm confused. Can somebody straighten me out? I've been looking a this for an hour and I just don't see what I am doing wrong.
Thanks!