I am trying to create a table in my DB with an identifier that is auto-incrementing itself, but whenever I try to add the AUTOINCREMENT keyword to my query, it tells me that:
AUTOINCREMENT is only allowed in INTEGER BASIC KEY
Here is my request:
@Override public void onCreate(SQLiteDatabase db) { String sql = "CREATE TABLE IF NOT EXISTS " + TABLE_TASKS + " ( " + KEY_ID + "INTEGER PRIMARY KEY AUTOINCREMENT, " + KEY_NOTETITLE + " TEXT, " + KEY_NOTECONTENT + " Text, " + KEY_STATUS + " INTEGER)"; db.execSQL(sql); }
I also tried writing AUTO_INCREMENT, but then received a syntax error.
I found out that this is the source of the problem, because whenever I try to delete the word AUTOINCREMENT, it works fine.
So ... what do you think is the problem?
source share