Database.LastInsertId Method
Gets the identity value of the last inserted record.
Namespace: DbExtensions
Assembly: DbExtensions.dll
Syntax
public virtual Object LastInsertId()
Return Value
Type: Object
The identity value of the last inserted record.
Remarks
It is very important to keep the connection open between the last command and this one, or else you might get the wrong value.