Towhid
Towhid

Reputation: 2084

Why this simple LINQ to SQL update query is not working?

I'm using VS 2010, MS SQL Server 2008, WPF 4

PalQuotationDataContext _palQuotationDataContext = new PalQuotationDataContext(); 
public void UpdateItemInformation(EItemInformation anItemInformation)
{
     var itemInformation = _palQuotationDataContext.ITEMs.Single(item =>
                                      item.IM_ID == anItemInformation.Id);
     itemInformation.IM_NAME = anItemInformation.Name;
     itemInformation.IM_DESCRIPTION = anItemInformation.Description;
     itemInformation.IM_BRAND = anItemInformation.Brand;
     itemInformation.IM_ORIGIN = anItemInformation.Origin;
     itemInformation.IM_ACESS_BY = anItemInformation.AccessBy;

     _palQuotationDataContext.SubmitChanges();
}

Upvotes: 0

Views: 799

Answers (1)

keyboardP
keyboardP

Reputation: 69372

Your table needs a primary key.

Upvotes: 2

Related Questions