Getting the ID of a new record

C

C CORDON

How can I get the ID (in a autonumber field) for the last added record in
access?

TIA!
 
P

Paolo

OleDbCommand idCMD = new OleDbCommand("SELECT @@IDENTITY", dbConnection);
newID = (int)idCMD.ExecuteScalar();
This worked for me!
 

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

Top