I am using LINQ to SQL to insert simple data into a table WITHOUT a stored procedure
. The table has a Primary Key ID column, which is set as an IDENTITY
column in both SQL Server
and in my DBML
.
First I call InsertOnSubmit();
with data for a single row, and then I call SubmitChanges();
to commit the row to the db. But I think there must be a simple way to then retrieve the row's IDENTITY
column value of the newly inserted row. I don't wish to provide the IDENTITY
column value to the db, I want it to generate one for me.
How is this best handled?