문제

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