开发者

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 });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜