After using the addnew method to add a record in asp, we often use to obtain the self-increasing ID, and it is easy to achieve this function using bookmark. After using the addnew method to add a record in asp, we often use to obtain the self-increasing ID, and it is easy to achieve this function using bookmark.
Copy the code code as follows:
rs.open sql,conn,3,3
rs.addnew
rs(user)=小男
rs(pass)=333333
rs.update
temp = rs.bookmark
rs.bookmark = temp
Response.write rs(ID)
access returns the self-increasing ID after addition
Used to asp in
Copy the code code as follows:
objRs.AddNew
objRs.Update
I don’t know how to return the sub-increasing ID in .net.
use
Copy the code code as follows:
select @@identity
This thing is only available in SQL.
Later I thought there was nothing I could do.
So:
1. First add a record.
2. Get max(id)
3. Modify data according to max(id)
It’s really troublesome~~ There may be problems with concurrency. I don’t know how you achieve it?
What you said is very strange. Obtaining the self-increasing ID is originally a SQL query.
In addition, ASP can also be implemented using pointers. .net don't know.
In fact, the original poster meant that select @@identity is only available in sqlserver.