I\'ve been getting this error for two days now, and I can\'t find the problem with my code.
here\'s the database code.
SQLHandler.java
If room
is a character type (and it is, according to the CREATE_TABLE_2
string where it's defined as TEXT NOT NULL
), you need to replace:
KEY_ROOM + "=" + r
with:
KEY_ROOM + "= '" + r + "'"
The way you have it, you're ending up with the query segment:
where room = kitchen1
and it's complaining that there's no kitchen1
column in that table, rightly so.
By quoting it, you end up with the correct:
where room = 'kitchen1'
This will turn the cursor creation line into:
Cursor c = ourDatabase.query(DATABASE_TABLE2, columns,
KEY_ROOM + "='" + r + "'", null, null, null, null);
// ^^^^^^^^^^^^^^^^^^^^^^^^^
// Changed bit