I see, I should create table like this:
db.execute('create table if not exists customers ' +
' ( ' +
' id INTEGER PRIMARY KEY
AUTOINCREMENT, ' +
' first_name varchar(30)' +
' )');
it's no problem !
On Feb 17, 5:18 pm, 浩翔 <[email protected]> wrote:
> I create table like this:
>
> db.execute('create table if not exists customers ' +
> ' ( ' +
> ' id int PRIMARY KEY, '
> +
> ' first_name varchar(30) ' +
>
> ' )');
>
> however, when i insert data like this:
>
> db.execute("insert into customers('first_name') values (?, ?)",
> ['Monkey!']);
>
> I got the result is :
>
> id first_name
> null Monkey!
>
> id is null !
>
> On Feb 17, 4:54 pm, Alex <[email protected]> wrote:
>
> > Hi all,
>
> > how to implement id auto increase when i insert a data to gears
> > database(sqlite3) ?
>
> > Thanks !
>
> > Alex