[Solved] no such column: id (code 1): , while compiling: DELETE FROM zhangdan WHERE id=?

Possible reason one: simply put, the name of the id column is wrongly written, can not find the id column

Double-check your delete in the sql statement id has not been written wrong, there may be a time when you set up a table may be different from the current one, the project with the former table, for example, I started to build a table with _id, and then change the code too many times, the statement to build the table also changed, but the project with the beginning of the table, so the sql statement still need to use _id

Possible reason 2: The database version was not increased, which led to this error

Add the following code to your MySQLHelper.java, which is used to upgrade the database

  @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    }
}

Similar Posts: