我想聯合查詢來創建一個XML文件。查詢本身就像T-SQL一樣工作,但是我的作爲LINQ-TO-XML的實現失敗,出現「Could not translate expression ...」錯誤。使用UNION的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))))