How to get the increment ID of the current article after adding content through AddNew in ASP-application techniques

Source: Internet
Author: User
When you add a record using the AddNew method in ASP, we often use an incremented ID, which is easy to implement with a bookmark.
Copy Code code as follows:

Rs.Open sql,conn,3,3
Rs.addnew
RS ("user") = "young Man"
RS ("pass") = "333333"
Rs.update
temp = Rs.bookmark
Rs.bookmark = Temp
Response.Write rs ("ID")

Access returns the added self-incrementing ID
Used in the ASP
Copy Code code as follows:

Objrs.addnew
Objrs.update

Instead of knowing how to return the child increment ID in. NET,
Use
Copy Code code as follows:

SELECT @ @identity

This thing is only SQL.
Then I couldn't figure it out,
This comes:
1, first add a record.
2, get Max (ID)
3. Modify data according to Max (ID)
What a trouble ah ~ ~ Concurrency estimates also have problems, do not know how to achieve it?

That's a strange remark you have to say. Getting the self increment ID is inherently querying SQL.

In addition, ASP can also use pointers to achieve. NET does not know.

In fact, the landlord's meaning select @ @identity only SQL Server only
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.