Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Last Insert ID in MS Access

by james2vegas (Chaplain)
on Jul 17, 2010 at 07:29 UTC ( [id://850070]=note: print w/replies, xml ) Need Help??


in reply to Re: Last Insert ID in MS Access
in thread Last Insert ID in MS Access

This article suggests that the correct syntax is SELECT @@IDENTITY, and that you should open a second connection to get it. This is presumably problematic with multiple users, so it is as effective (and unreliable) as MAX(ID) would be. I think you could probably lock the table for update and unlock the table after getting the last id.

Replies are listed 'Best First'.
Re^3: Last Insert ID in MS Access
by mje (Curate) on Jul 19, 2010 at 08:28 UTC

    I think you'll find it doesn't work if run in a "second connection". I think you just need to ensure it is run as a new statement in the same connection after any outstanding commit.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://850070]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-03-28 12:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found