Here Mudassar Ahmed Khan has explained with an example, how to get ID of last inserted record using ADO.Net and SCOPE_IDENTITY in ASP.Net MVC Razor.
When the Form is submitted, the value of the submitted Form fields will be fetched using Model class object and will be inserted into database. After successful insert, the ID of the last inserted record fetched using SCOPE_IDENTITY will be displayed using JavaScript Alert Message Box.
↧