我刚向数据库inert了一条记录,id是自增的,我怎么能再得到这个id? 数据库存储过程最后加return @@identity 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 写入数据后,马上取此 id 值。string str = "select @@identity from table";SqlCommand sqlCmd = new SqlCommand(str,sqlConnection);....Response.Write(sqlCmd.ExecuteScalar().ToString()); 同时执行插入和下面这个sqlselect @@identity 可以做一个Session会方便些,也不容易出错 在Insert语句后加;select @@identity as newidentity再用ExecuteScalar()返回 GridView编辑和框架互动的问题 网站有多种语言问题,如何实现 点击事件弹出页面问题 IIS发布时出现的问题(只剩下10分全给了) 五一搞笑短信征集分享 利用XSL如何提取XML文件中的前十条数据? 鼠标事件问题 新手一个很菜的问题.急,在线等!! 搞不懂,奇怪的问题,如下 怎样把一个字符串中的所有空格替换成html中的空格符号?? 关于水晶报表简单问题!解决高分马上送上!!!!!!!!!!!!!!!!!!!! 请问如何让一个服务器端的textbox控件在页面打开时自动获得输入焦点?
string str = "select @@identity from table";
SqlCommand sqlCmd = new SqlCommand(str,sqlConnection);
....
Response.Write(sqlCmd.ExecuteScalar().ToString());
select @@identity
;select @@identity as newidentity
再用ExecuteScalar()返回