如果为SQL2000的话
.....前面为添加记录的代码
rs.update
sql="select @@identity as id"
set rs1=server.createobject("adodb.recordset")
rs1.open sql,conn,1,1
if not rs.eof then
pid=rs1("id") 'pid就是刚才的记录ID
conn.execute sql
end if
rs1.close
set rs1=nothing
rs.close
.......
[此贴子已经被作者于2006-10-17 17:08:49编辑过]