DatabaseHelper DatabaseHelper - 1 month ago 11
Android Question

How to update only first row in SQlite without a sequential int identifier?

I would like to update the first row only. But I don't have a primary key, any sequential identifier.

ContentValues values = new ContentValues();

values.put(COLUMN_UNAME, c.getUname());
values.put(COLUMN_PASS, c.getPass());

db.update(TABLE_NAME,values,???,???);


How to update only first row in SQlite without a sequential int identifier?

Answer

If there is only ever one row in the table, you can use null, null as the last two arguments, which will update all the rows in the table.