public Cursor getChart(String sign ) {
return db.query(CHART_TABLE, new String[] {
KEY_CHART_ID,
KEY_SIGN,
KEY_TOTAL },
KEY_SIGN + "=" + sign,
null, null, null, null, null);
}
05-09 17:14:39.260: ERROR/AndroidRuntime(14935): android.database.sqlite.SQLiteException: near "+": syntax error: , while compiling: SELECT _id, sign, total FROM ChartTable WHERE sign=+
答案 0 :(得分:3)
查询数据库的错误方法。试试这个..
public Cursor getChart(String sign ) {
return db.query(CHART_TABLE, new String[] {
KEY_CHART_ID,
KEY_SIGN,
KEY_TOTAL },
"KEY_SIGN =?", new String[]{sign},
null, null, null);
}