2008-12-11 37 views
1

使用LINQ to SQL:更新值到SQL IEnumerable的

if(!parentlist.childlist.Contains(row1)) 
     parentlist.childlist.Add(row1); 
else 

如何更新所需的childList一行ROW1?子列表的每一行都有一個唯一的ID。

parentlist implements IEnumerable and childlist is IList

回答

0

我不認爲你可以這樣做。您需要從datacontaxt中選擇chidlist項目,然後將該行添加並提交。

其實並不令人滿意,但我認爲它只是linq2sql令人討厭的限制之一。