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 stat开发者_StackOverflow中文版ement.
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?
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 });
精彩评论