Getting last Insert ID

  • Thread starter Thread starter Totto
  • Start date Start date
T

Totto

Hi,
I'm using a Access database with a dot.net application. To get last insert
Id(Autogenerated) from a specific tabel, I have used
"Select Max(Id) from table" to populate a datareader. I then use
"Reader.getint32" to get the id. This works fine when there is something in
the tabel. But when the table is empty I get a cast error, obviusly since
the Getint32 returns nothing. Is there a better way to get Last insert Id
from a Access database ?

TNX
Totto
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top