I am trying to get last auto number after inserting record into access database. I am getting zero. Not sure what I am doing wrong. I tried to google but could not find any simple example which I can use to understand.
// Database was opened before.
cmd.ExecuteNonQuery(); // Insert is working fine.
cmd = new OleDbCommand("SELECT @@IDENTITY", con);
id = cmd.ExecuteNonQuery(); // id shows zero in debug