0

我在这段代码中遇到错误。

Cursor cursor = ourDatabase.rawQuery(
    "SELECT * FROM " + DATABASE_TABLE + " WHERE KEY_ID BETWEEN 15 AND 20",
     null);

我的 LogCat 说它error near ? ****** BETWEEN ? 说你在做什么。我无法弄清楚错误。请帮忙。

4

1 回答 1

0

我相信KEY_ID是你的变量,比如DATABASE_TABLE,而不是实际的列名。尝试:

Cursor cursor = ourDatabase.rawQuery(
    "SELECT * FROM " + DATABASE_TABLE + " WHERE " + KEY_ID + " BETWEEN 15 AND 20",
     null);
于 2013-01-09T20:51:23.047 回答