I am using SQLite database where I have stored the credentials, but when I want to authenticate e-mail address, it gives me error:
E/AndroidRuntime: android.database.sqlite.SQLiteException: near "@xyz": syntax error (code 1): , while compiling: SELECT _id, name, email, password, phone, flag FROM tableThree WHERE email = jack.sparrow@xyz.com
I am using DBHelper where I have method for authentication as:
public boolean authMail(String fieldValue) {
String where = KEY_EMAIL + " = " + fieldValue ;
Cursor c = db.query(false, DATABASE_TABLE, ALL_KEYS,
where, null, null, null, null, null);
if (c.getCount() <= 0) {
c.close();
return false;
}
c.close();
return true;
}
where KEY_MAIL = "email" and ALL_KEYS = new String[]{KEY_ROWID, KEY_NAME, KEY_EMAIL, KEY_PASSWORD, KEY_PHONE, KEY_FLAG};
What is done wrong here? Since, other methods with same syntax works just fine.
Aucun commentaire:
Enregistrer un commentaire