我試圖從Customer表中獲取customerId。MVC3通過LINQ選擇int值
然而,當我儘量做到,它錯誤說「無法隱式轉換類型‘System.Linq.Iqueryable’到'廉政」
我怎樣才能得到客戶ID?
謝謝。
這裏是我的編碼。
int customerId = from a in db.Customer
where a.userName == customerName
select a.customerId;
//it has error in here.
order.customerId = customerId;
如果'customerID'是唯一比它應該是'單()'而不是'首先()' – MarcinJuraszek 2012-04-16 16:39:18
非常感謝!伴侶 – wholee1 2012-04-16 16:39:59