0

In the table I have 4 fields (note1, note2, note3, Note4). I want to delete all the data in note1 and note2. I have to add arguments to the method db.delete, but I have trouble.

public void delete() {
  SQLiteDatabase db= mHelper.getWritableDatabase();
  db.delete(noteTable.TABLE_NAME, null, null);
}
0

1 Answer 1

1

Delete always deletes entire rows.

To clear values in specific columns, use an update query, for example

ContentValues cv = new ContentValues();
cv.putNull("note1");
cv.putNull("note2");
db.update(noteTable.TABLE_NAME, cv, null, null);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.