Returning the value of an identity column during/after SQL INSERT command
- by Adam Kane
Using VS 2010, with ASP.NET, and .NET 3.0, and C#...
When I use a System.Web.UI.WebControls.SqlDataSource and call its Insert() method to insert a new row, and that table has an identity column, I'd like my method to return the value of that column.
For example, in my SQL 2005 table, I've got:
Customer.Id
Customer.FirstName
Customer.LastName
…