set rs2=server.CreateObject("adodb.recordset")
sql2="SELECT @@IDENTITY as selectid from product"
rs2.open sql2,conn,1,1
if not rs2.eof and not rs2.bof then
selectid=rs2("selectid")
else
selectid=0
end if
rs2.close
set rs2=nothing
sql2="SELECT @@IDENTITY as selectid from product"
rs2.open sql2,conn,1,1
if not rs2.eof and not rs2.bof then
selectid=rs2("selectid")
else
selectid=0
end if
rs2.close
set rs2=nothing
本文介绍了一段ASP.NET代码,该代码用于通过ADO.NET RecordSet对象打开一个存储过程来获取数据库中最后插入记录的ID。如果查询成功,则返回对应的ID值;如果未找到记录,则返回0。
1677

被折叠的 条评论
为什么被折叠?



