问题是,当我使用"选择新的" statemet我不再允许将DataGrid和SubmitChanges中的信息编辑到sql server。
dataGrid2.ItemsSource = from a in dc.Provider from c in dc.ProviderItems
where a.Name == comboBox.SelectedItem.ToString()
from b in dc.Category
where b.CategoryID == c.CategoryID
where c.ProviderID == a.ProviderID
select new {
Name = c.Name,
Price = c.ProviderPrice,
Category = b.Name
};
答案 0 :(得分:0)
为什么不创建一个具有这三个属性(名称,价格,类别)而不是选择新的{}的新类,执行以下操作:
select new MyNewClass
{
Name = c.Name,
Price = c.ProviderPrice,
Category = b.Name
};