質問

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);
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top