10

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?

1
  • is your tablename correct? Is your Id field unique? (if so, why the extra QstnrId and QstnId?) Commented Jan 31, 2011 at 11:10

1 Answer 1

23

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 });
Sign up to request clarification or add additional context in comments.

1 Comment

sorry yeh i think that works, i am not passing down the correct values into the id fields

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.