I'm getting error in this code.
Cursor cursor = ourDatabase.rawQuery(
"SELECT * FROM " + DATABASE_TABLE + " WHERE KEY_ID BETWEEN 15 AND 20",
null);
My LogCat says error near ? ****** BETWEEN ?
It says what are you doing. I'm not being able to figure out the mistake. Please help.
I believe KEY_ID
is your variable, like DATABASE_TABLE
, not the actual column name. Try:
Cursor cursor = ourDatabase.rawQuery(
"SELECT * FROM " + DATABASE_TABLE + " WHERE " + KEY_ID + " BETWEEN 15 AND 20",
null);