2011-07-09 90 views
0

我使用VS 2010,MS SQL Server 2008中,WPF 4爲什麼這個簡單的LINQ to SQL更新查詢不起作用?

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(); 
} 
+2

您的表是否有主鍵? – keyboardP

+3

什麼是錯誤?解決問題要容易得多,如果我們知道什麼是錯的...... –

+0

@ keyboardP:謝謝。你解決了我的問題。 – Towhid

回答

相關問題