以下是导致问题的我的数据库方法:
public Cursor fetchRecord(String pin,String category)throws SQLException
{
Cursor c=mDb.query(DATABASE_TABLE, new String[]
{KEY_ROWID,KEY_NAME,KEY_PHONE,KEY_CATEGORY,KEY_PINCODE},
KEY_PINCODE + "= ?" + "AND" + KEY_CATEGORY + "= ?",
new String[]{pin,category}, null, null, KEY_NAME);
if (c!= null) {
c.moveToFirst();
}
return c;
}
每当我输入并单击日志猫说的第一个活动中的“开始”按钮时,它就会强制关闭:
Caused by: android.database.sqlite.SQLiteException: near "ANDcategory": syntax error: , while compiling: SELECT _id, name, phone, category, pincode FROM details WHERE pincode= ?ANDcategory= ? ORDER BY name