
Untitled
By: a guest on
Aug 9th, 2012 | syntax:
None | size: 0.82 KB | hits: 46 | expires: Never
C# Linq to SQL:cannot add an entity that already exists
private static void AddNewPriceSettings(PRICE_SETTING priceSettingsInfo)
{
PRICE_SETTING priceSetting = new PRICE_SETTING();
priceSetting = priceSettingsInfo;
DataContext.CommonUsers.PRICE_SETTINGs.InsertOnSubmit(priceSettingsInfo);
DataContext.CommonUsers.SubmitChanges();
}
private static void AddNewPriceSettings(PRICE_SETTING priceSettingsInfo)
{
PRICE_SETTING priceSetting = new PRICE_SETTING();
//
priceSetting.Prop1 = priceSettingsInfo.Prop1;
priceSetting.Prop2 = priceSettingsInfo.Prop2;
priceSetting.Prop3 = priceSettingsInfo.Prop3;
// ...
DataContext.CommonUsers.PRICE_SETTINGs.InsertOnSubmit(priceSetting );
DataContext.CommonUsers.SubmitChanges();
}
cannot add an entity that already exists