我试图从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