asp如何取得插入记录后最新ID的值?-ASP基础教程 by alixixi.com
ACCESS库可以这样书写:
set rs = server.createobject(“adodb.recordset”)
sql = “select * from news”
rs.addnew
rs(“title”) = “测试”
rs(“content”) = “内容”
rs.update
newid = rs(“id”)
rs.close
SQLSERVER用上面的方法不行,必须在UPDATE后多加一句,rs.movelast.
set rs = server.createobject(“adodb.recordset”)
sql = “select * from news”
rs.addnew
rs(“title”) = “测试”
rs(“content”) = “内容”
rs.update
rs.movelast
newid = rs(“id”)
rs.close
评论前必须登录!
注册