Skip to content

SQLite3 设置主键自增无效 #2

Description

@coderqianlq

实体类定义如下:

public class People {
    public int ID = -1;
    public String Name;
    public int Age;
    public double Height;
}

sql语句如下:

db.execSQL("create table if not exists " + DB_TABLE + " (ID integer " +
                " primary key autoincrement, " +
                " name varchar(20)," +
                " age integer," +
                " height double)");

执行db.insert(DB_TABLE, null, newValues);主键始终为-1,不自增。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions