日期:2014-05-20 浏览次数:20673 次
foreach(var r in q) { Console.WriteLine(r.CustomerId); }
------解决方案--------------------
var q = from c in dc.Customers select c.CustomerId;
------解决方案--------------------
咋不结贴呢,2楼的方法不行?
------解决方案--------------------
var q = from c in db.Customers select c.CustomerID; foreach (var id in q) { Response.Write(id + ","); }
------解决方案--------------------
假设CustomerId的类型是long,可以写:
var q = from c in dc.Customers select c;
var r= from Customer c in q select c.id; //取出每行CustomerId的值