使用sqlite执行插入语句返回主键

在插入语句的后面添加一条语句:select last_insert_rowid();便可返回刚刚插入行的主键值。sql

insert into Diary (Task,Content) values ('xxx','xxx'); select last_insert_rowid();

相关文章
相关标签/搜索