Beginner
Beginner

Reputation: 29533

Android SQLite Delete row issue

I am trying to delete a row from a table but i have three WHERE clauses and i am not sure if i am using the correct statement.

    db.delete(DBAdapter.TableName, "Id="+ Id
          +" AND WHERE QstnrId = "+Integer.parseInt(QuestionnaireId)
          +" AND WHERE QstnId = "+Integer.parseInt(QuestionId), null);

I am almost certain i am not using the statement correctly. Please assist?

Upvotes: 10

Views: 15690

Answers (1)

Marcelo Cantos
Marcelo Cantos

Reputation: 185852

You don't need to use the WHERE keyword. Also you could try using the third parameter to delete():

db.delete(DBAdapter.TableName, "Id=? AND QstnrId=? AND QstnId=?",
          new String[] { Id.toString(), QuestionnaireId, QuestionId });

Upvotes: 23

Related Questions