您的位置:程序门 -> .net技术 -> asp.net



我的后台代码应该改成什么样的啊??


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


我的后台代码应该改成什么样的啊??[已结贴,结贴人:sn3009]
发表于:2007-03-19 00:09:42 楼主
我存储过程中用的是@@identity想得到刚刚插入数据的id
在后台我的代码是
sqlparameter   id   =   new   sqlparameter( "@id ",sqldbtype.int);

id.direction   =   parameterdirection   .output;
comm   .parameters   .add(id);

conn.open();
comm   .EXECutenonquery();
conn.close();
object   outputid   =   comm.parameters[ "@id "].value.tostring();

this.txtid   .text   =   id.tostring();

但页面显示的结果是@@identity
请各位指点我怎么显示id啊!
发表于:2007-03-19 06:35:431楼 得分:10
你的存储是如何写的,有这样set   @id   =   @@identity么?
发表于:2007-03-19 07:44:232楼 得分:10
create   procedure   procname

            @outputid   int   output,
            @paraname1   type,
            @paraname2   type
)
as
insert   into   tablename(section1,section2)   values()
select
@output=@@identity
go


快速检索

最新资讯
热门点击