Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
4
Answers
Getting your last saved record in database
Administrator
21y
2k
1
Reply
Hi guys. When I insert a new record to my database, I need to grab the ID (identity/auto increment field) of that record RIGHT AWAY. What I have done in the past, is to run a query SELECT MAX(ID) FROM
right after I inserted the new record, but this can't be a fool-proof way of doing it. What if someone else inserts a new record before I run my SELECT MAX query? So, my question is: does anyone know of a better way? Is there any built-in functionality for this in ADO.NET? Thanks!
Post
Reset
Cancel
Answers (
4
)
Next Recommended Forum
How to Retrieve a ListviewItem
UserControl problem