【发布时间】:2015-04-30 18:52:33
【问题描述】:
请参考我下面的代码。返回值发生异常错误。
无法将“System.Data.Objects.ObjectQuery1[VB$AnonymousType_23[System.String,System.String,System.String]]”类型的对象转换为“System.Collections.Generic.List`1[MyEntities.stk_cust]” '。
Public Function GetCustomerProdListToGrid() As List(Of stk_cust)
Dim result = From s In Db.stk_cust
Group Join d In Db.s_armaster On d.dbcode Equals s.dbcode Into stk_ar = Group
From d In stk_ar.DefaultIfEmpty()
Order By s.stk_code, s.dbcode Ascending
Select s.stk_code, s.dbcode, d.name
Return result
End Function
我在选择部分尝试了以下方法,但错误结果相同
Select New With {.stk_code = s.stk_code,
.dbcode = s.dbcode,
.name = d.name
}
非常感谢任何帮助。
【问题讨论】: