Getting the ID of a new record

  • Thread starter Thread starter C CORDON
  • Start date Start date
C

C CORDON

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

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