Is it possible to get the Identity column value once the record is inserted into the table successfully?
Thanks.
M G
3 Answers, 1 is accepted
0
Serge
Telerik team
answered on 21 May 2010, 04:56 PM
Hi M G,
After you call scope.Transaction.Commit() (or .SaveChanges() in case you are using the new context approach)the identity column values are automatically populated with the new values. You can directly access them.
Hope this helps.
All the best,
Serge
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items.
i am not using transaction for adding new enitity.
i am using ria service for communication.
after i add new object to entity through entitymodel new value of identity column not populated in that new object.
is there any settings we need to do for that ????
please help me
0
PetarP
Telerik team
answered on 23 Mar 2012, 02:51 PM
Hello Gaurav,
No there shouldn't be any additional steps you need to do. Can you please look into the generated sql after you call context.SaveChanges and check if you get an select scope_identity() statement generated at the end of your insert query? If you are having that indeed appended can you please mark your primary key with the [Key] attribute inside your model.