Android Sqlite查询绑定或列超出范围

时间:2011-11-23 23:38:30

标签: android sqlite

我从下面的查询中获取此logcat输出。我知道所有列都在我试图访问的表中。这个错误意味着什么?

11-23 23:33:48.207: ERROR/AndroidRuntime(16941): Caused by: android.database.sqlite.SQLiteException: bind or column index out of range: handle 0x2cc688

查询:

Cursor value = checkDB.rawQuery("SELECT * FROM table WHERE open='1' AND country='?'", new String[]{countryID});

2 个答案:

答案 0 :(得分:2)

查询中的?周围不需要引号。

答案 1 :(得分:-1)

尝试使用:

Cursor value=checkDB.query(table,new String[]{"*"},"open=1 and country="'"+countryID+"'",null,null,null,null);