If you're using ASP.NET, you can use this code to get the last insert ID,
Database.GetLastInsertId()
[
^]. However, a turn around is to select the last record and get the ID column of that. Something like this,
var db = Database.Open("databaseName");
var selectQuery = "SELECT TOP 1 * FROM table_name DESC";
var column = db.Query(selectQuery);
.. now this column object will contain all of the values for that column, so you can just call the property to get the ID of this record.