android.database.sqlite.SQLiteException: near “…”: syntax error (code 1)

后端 未结 4 677
猫巷女王i
猫巷女王i 2021-01-14 15:19

When i open my RSS app, i would like to check if an article exists in my database.If it exists,i would like to delete it (or ignore it),if not to write it in the db.

4条回答
  •  不要未来只要你来
    2021-01-14 16:08

    Don't use the raw query unless you have no other choice!

    Cursor findEntry = db.query(TABLE, columns, DBHelper.TITLE + "=?", new String[] { title }, null, null, null);
    

    or for multiple stuff

    Cursor findEntry = db.query((TABLE, columns, DBHelper.TITLE + "=? and " + DBHelper.DATE + "=?", new String[] { title, date}, null, null, null);
    

提交回复
热议问题