Im trying to get an object form my SQLite database in my Android application. I know that the contact is in the database because when I add it and try finding by ID, it returns the object. When I try finding by first and last name, though, it throws an exception and Im left with a null reference. Here is the query:
cursor = mDb.query(DB_CONTACTS_NAME,
new String[] {KEY_ID, KEY_LAST_NAME, KEY_FIRST_NAME, KEY_EMAIL_ADDRESS,
KEY_ORGANIZATION_NAME, KEY_LABEL, KEY_LABEL_POSITION},
KEY_FIRST_NAME + "=" + first + " AND " + KEY_LAST_NAME + "=" + last,
null, null, null, null
);
Ive also tried to find just by first name and just by last name. Same result as above.
Edit: The exception is an SQLite exception
no such column: aurelius: , while compiling: SELECT _id, last_name, first_name,
email_address, organization_name, label, label_position FROM contacts WHERE
first_name=marcus AND last_name=aurelius
And also happens when trying to select just first or last name
no such column: marcus: , while compiling: SELECT _id, last_name, first_name,
email_address, organization_name, label, label_position FROM contacts WHERE
first_name=marcus