Android的SQLite的删除行的问题问题、Android、SQLite

由网友(扶南)分享简介:我想从表中删除行,但我有三个WHERE子句,我不知道如果我使用正确的说法。 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 state...

我想从表中删除行,但我有三个WHERE子句,我不知道如果我使用正确的说法。

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?

推荐答案

您不需要使用,其中关键字。你也可以尝试使用第三个参数删除()

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 });
阅读全文

相关推荐

最新文章