insert into tb(...) values (...) select @@identity可以这样用吧? insert into tb(...) values (...) select @@identity但是属于selectcommad 还是 insertcommand有人试验过吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 insert into tb(...) values (...) ; select @@identity用reader接收 select @@identity 的值 sql可以一次执行多条语句,可以用来返回select @@identity 属于 SelectCommand 吧,没试过我的理解是它有返回值就可以作为 SelectCommand 我现在是在asp.net中用 不知道cmd.selectcommand = sqlstr 还是 cmd.insertcommand=sqlstr;还是不能这样用楼上说用reader我试试看~~ 我还以为你要在 SqlDataSource 中使用你这个需求,可以把那句 SQL 赋值给 SqlCommand 对象的 CommandText 属性,然后使用 cmd.ExecuteScalar() 方法获得返回值也可以向上面那位说的那样,用 reader 读出返回值 弄错了~ sqlcommand只有commandtext 没有 selectcommand 和insertcommandselectcommand 和 insertcommand是sqldataadapter的 ListBox MVC添加视图的问题,在线等,拜托了。。。 急。。。。。。为什么在listBox中选择了。但是SelectedItem还是为空? 关于.net中ajax几种方式(欢迎讨论) 一个关于查询显示的小问题 打印DataGrid(web) 为什么我的 DataGrid1_UpdateCommand 事件不能获得我新修改的值??? 关于‘三楼楼主’提供那个精品OA的源码有编译成功的吗?进来帮下忙 如何判断一个网站是真静态还是伪静态 子页面的问题????急!!!!!!在线等待 急求解决firefox中file问题 在后台怎么添加js事件?
我的理解是它有返回值就可以作为 SelectCommand
不知道cmd.selectcommand = sqlstr 还是 cmd.insertcommand=sqlstr;
还是不能这样用
楼上说用reader
我试试看~~
我还以为你要在 SqlDataSource 中使用你这个需求,可以把那句 SQL 赋值给 SqlCommand 对象的 CommandText 属性,然后使用 cmd.ExecuteScalar() 方法获得返回值也可以向上面那位说的那样,用 reader 读出返回值