wood burning stoves*
The moose likes JDBC and the fly likes MSAccess last insert ID ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "MSAccess last insert ID ?" Watch "MSAccess last insert ID ?" New topic
Author

MSAccess last insert ID ?

andrew beales
Greenhorn

Joined: Nov 04, 2002
Posts: 15
Hello,I want to use something similar to the last insert ID function in mysql.I want to create a new entry in a table and just add an ID of autonumber increment type.I want to be able to view this and manipulate this value.Is ther such a method to peek at the last insert ID of a table?
Please help.
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923



http://home.arcor.de/hirnstrom/bewerbung
Eddie Vanda
Ranch Hand

Joined: Mar 18, 2003
Posts: 281
You may need to synchronize the two JDBC calls in case another client comes in and adds a record in between your two calls.


The nice thing about Standards is that there are so many to choose from!
Blake Minghelli
Ranch Hand

Joined: Sep 13, 2002
Posts: 331
If you are using Access 2000 or greater, then I heard (never tried it myself) you can do this: (just like SQLServer) and it will return the last autonumber inserted by your connection.


Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: MSAccess last insert ID ?
 
Similar Threads
how to create a table through ajax dynamically
MySQL Date field , how to assign current date as default value ?
Easy SQL into Hibernate Criteria
where to generate the primary keys for EntityBeans
JSP to hibernate