Android SQLite auto increment

后端 未结 4 1787
旧时难觅i
旧时难觅i 2020-12-01 05:55

I currently have a table called User which has a id column which is created as

\'INTEGER PRIMARY KEY\'

Lets say I have created two users so the table has id

4条回答
  •  囚心锁ツ
    2020-12-01 06:42

    Just remember for android when writing tot the database (ie. executing),

    do INSERT INTO TABLE_NAME (param1name, param2name) VALUES (param1,param2)

    and there is no need to add a place holder for the auto increment. It will add it by itself when adding a record. If you do not declare the params that you will put in, you will get the error x amount of variables expected and you only gave x-1, and this is because you are not supposed to give any place holding value for the auto increment column

提交回复
热议问题