码迷,mamicode.com
首页 > 其他好文 > 详细

插入一条新数据,如何返回主键值id,id是自动增长的

时间:2015-10-15 23:40:43      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:

strSQL = "INSERT INTO tablename (name) VALUES (@name);SELECT @@Identity"
SQLCommand.CommandText = strSQL
Id = SQLCommand.ExecuteScalar()

  

插入一条新数据,如何返回主键值id,id是自动增长的

标签:

原文地址:http://www.cnblogs.com/qi123/p/4883877.html

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