Query having 2 Where Clause

Posted by Harsha M V on Stack Overflow See other posts from Stack Overflow or by Harsha M V
Published on 2010-12-26T08:29:41Z Indexed on 2010/12/26 8:54 UTC
Read the original article Hit count: 193

Filed under:
|

i am trying to login and want to validate username and password against the records in the database. I am not sure how to pass two Where clause

public Boolean login(String username, String password) throws SQLException {
    Cursor mCursor = db.query(TABLE_USERS, new String[] { ID,
            KEY_NAME, KEY_USERNAME}, KEY_USERNAME + "="
            + "'"+username+"'", KEY_PASSWORD + "="
            + "'"+password+"'", null, null, null, null, null);

    if (mCursor.moveToFirst()) {
        return true;
    }
    return false;
}

Am getting a Syntax Error.

© Stack Overflow or respective owner

Related posts about android

Related posts about android-sqlite