ECommerceAdoEntities oContext = new ECommerceAdoEntities();
var lstnames = from c in oContext.tbl_ShippingProfile select c.Name;
当我尝试针对ADO.net实体数据模型数据源运行linq查询并返回多个列(c.Name,c.ID)时,它在C#中给出了错误
但是在VB中我能够做到。
Dim adoDataEntity As New ECommerceAdoEntities()
Dim lstAdoSource = From c In adoDataEntity.tbl_ShippingProfile Select c.Name, c.ID
知道为什么吗?
答案 0 :(得分:3)
var lstnames = from c in oContext.tbl_ShippingProfile
select new
{
c.Name,
c.ID
};