ACCESS庫可(kě)以這(zhè)樣書(shū)寫:
set rs = server.createobject("adodb.recordset")
sql = "select * from news"
rs.addnew
rs("title") = "測試"
rs("content") = "内容"
rs.update
newid = rs("id")
rs.close
SQLSERVER用(yòng)上面的(de)方法不行,必須在UPDATE後多(duō)加一句,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