Reputation: 169
I have a database with columns :id,question,answer1. I want the user to enter the id and return the specific question everytime. I have a problem using the query!Can anyone help?
Upvotes: 0
Views: 1054
Reputation: 137322
Assuming you want the fields of COLUMN1
and COLUMN2
, and id
is the row-ID:
SQLiteDatabase db = getReadableDatabase();
Cursor cursor = db.query(TABLE_NAME, new String[] { COLUMN1, COLUMN2
}, ID + "=?", new String[] { String.valueOf(id) }, null, null, null, null);
Upvotes: 3