Reputation: 1049
I have a new insert which i then need to get the ID of the item just inserted
var provider = new tbl_Provider
{
provider_Name = txt_ProviderName.Text,
provider_Contact = txt_ProviderContactName.Text,
provider_Address1 = txt_Address1.Text,
provider_Address2 = txt_Address2.Text,
provider_Address3 = txt_Address3.Text,
provider_Postcode = txt_Postcode.Text,
provider_Telephone = txt_Telephone.Text,
provider_Deleted = false
};
//provider.tbl_ProviderDetails. = lst_ServiceAreas.SelectedValue;
// Insert
// ======
_db.tbl_Providers.InsertOnSubmit(provider);
// Save
// ====
_db.SubmitChanges();
How would i do this in Linq.
I have done it before with select Scope Identity but I am trying Linq on this Project.
Upvotes: 1
Views: 118