我正在使用该函数从表中检索一个值,
public ArrayList selectValue(SQLiteDatabase sqliteDB, String contactEmail){
Cursor c = sqliteDB.rawQuery("SELECT * FROM " + TABLE_NAME + " WHERE ContactEmail='"+contactEmail+"'",null);
if (c != null ) {
if (c.moveToFirst()) {
do {
double contactId = c.getDouble(c.getColumnIndex("ContactId"));
results.add("ContactEmail: " +contactEmail+ ",ContactId: " + contactId);
}while (c.moveToNext());
}
}
return results;
}
但是上面的函数从表中检索所有值..不确定查询有什么问题..
我也尝试过硬编码这样的值,
Cursor c = sqliteDB.rawQuery("SELECT * FROM " + TABLE_NAME + " WHERE ContactEmail='peter@peter.com'",null);
但这也给出了所有行。我在这里错过了什么吗?请帮忙