• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get the last ID in the auto incremented field

 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there
I have a table with a field, ID, and its incremented every time there is a new data entry.

say a user has just completed adding new info - how can i get the ID?

thanks
Peter
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter,
Take a look at this page. It's for db2, but it works the same in most major databases.
 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it helps!
thanks
Statement.RETURN_GENERATED_KEYS
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic