使用了下面的方法:
public String getCount() {
SQLiteDatabase db = smokinDBOpenHelper.getWritableDatabase();
String w = "Home";
Cursor cursor = db.rawQuery("select * from " + smokinDBOpenHelper.INCIDENTS_TABLE +
" where " + KEY_LOCATION + " = 'Home'", null);
int i = cursor.getCount();
String s = ("You have " + i + " entries in this column");
return s;
}
我希望这个查询能使用变量,现在用的是特定的硬编码字符“home”
我用过+ {w}
+ {w%}
+ w
。
但是没实现。谢谢