LINQ to XML : A query body must end with a select clause or a group clause

前端 未结 6 1223
广开言路
广开言路 2021-01-20 01:31

Can someone guide me on to repairing the error on this query :

       var objApps = from item in xDoc.Descendants(\"VHost\") 
                          where         


        
6条回答
  •  無奈伤痛
    2021-01-20 02:32

    You are missing select in query within where clause, you can change it something like

    var objApps = from item in xDoc.Descendants("VHost") 
                         where(item.Descendants("Application").Any())
                         select new clsApplication
                         {
                               ConnectionsTotal = item.Element("Application").Element("ConnectionsTotal").Value
                         };
    

提交回复
热议问题