【发布时间】:2010-02-04 23:57:34
【问题描述】:
我正在尝试联合查询以创建 XML 文件。查询本身作为 T-SQL 工作,但我作为 LINQ-TO-XML 的实现失败并出现“无法翻译表达式...”错误。
我问错问题了吗?这种方法完全错误吗?我是 LINQ 的新手。如何从 2 个查询创建单个 XML?
Dim db As New SOMEDataContext
Dim members As New XElement("members", _
(From c In db.Employees _
Join cf In db.BowlingTeams On c.ID Equals cf.BowlingTeam_Text _
Where c.DEPARTMENT = "Housewares" _
Select New XElement("member", _
New XElement("id", c.ID), _
New XElement("title", c.TITLE))) _
.Union(From e In db.Employees _
Where e.DEPARTMENT = "Housewares" _
Where e.POSITION Like "*XYZ*" _
Select New XElement("member", _
New XElement("id", e.ID), _
New XElement("title", e.TITLE))))
【问题讨论】:
标签: vb.net linq-to-xml