我的动态LINQ Select语句存在我认为是语法问题,这是我的代码:
Dim both = (From row1 In AddressListDatatable.AsEnumerable()
Join row2 In MatrixDatatable.AsEnumerable()
On row1.Field(Of String)("Offercode") Equals row2.Field(Of
String)("Code") Select row1, row2)
Dim data = both.Select("new (row1.Account, row1.First, row1.OFFERCODE,
row2.Expiration, row2.OfferDescription)")
这是我得到的错误:“'DataRow'类型中没有属性或字段'帐户'”
所以,我认为问题在于这个语法: row1.Account,row1.First等
答案 0 :(得分:1)
你试过吗?:
var data = both.Select(new {row1.Account,row1.First,row1.OFFERCODE, row2.Expiration,row2.OfferDescription})