码迷,mamicode.com
首页 > 数据库 > 详细

linq2db Sqlite Insert之后获取插入的自增量ID值

时间:2017-07-06 18:39:56      阅读:271      评论:0      收藏:0      [点我收藏+]

标签:new   code   style   sql   nbsp   pre   增量   插入   bsp   

方法为:

public static object InsertWithIdentity<T>(this IDataContext dataContext, T obj);


例:

var rowId = db.InsertWithIdentity(newRow);
newRow.Id = (long)rowId;

 

对应的SQL语句为:

SELECT last_insert_rowid()

 

linq2db Sqlite Insert之后获取插入的自增量ID值

标签:new   code   style   sql   nbsp   pre   增量   插入   bsp   

原文地址:http://www.cnblogs.com/shanon/p/7127459.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!