Reputation: 85056
I'd rather not make a call to the database to query @@IDENTITY. Is there some way to get the identity value for what was just inserted through code?
Upvotes: 0
Views: 1621
Reputation: 85056
Found a solution by adding an OnInserted event to my LinqDataSource that my listview was using. See below:
protected void lds_Personnel_OnInserted(object sender, LinqDataSourceStatusEventArgs e)
{
int id= ((Personnel)e.Result).IdentityNameHere;
.
.
.
}
Hope it's helpful to someone.
Upvotes: 1