本文介绍了Linq到XML查询不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Dim BookingDatabase As XDocument = XDocument.Load( https://itunes.apple.com/us/rss/topsongs/limit=10/xml)
Dim feeds =来自feed BookingDatabase.Descendants( 条目)
选择 mytitle = feed .Element( title)。价值,
myrights = feed.Element( rights)。值
对于 每个提要在提要
Dim myLabel As 新标签
myLabel.Text = feed.mytitle.First.ToString& - & feed.myrights.First.ToString
PlaceHolder1.Controls.Add(myLabel)
Next
我看不出我做错了什么 - 但没有结果
想法?
解决方案
Dim BookingDatabase As XDocument = XDocument.Load("https://itunes.apple.com/us/rss/topsongs/limit=10/xml") Dim feeds = From feed In BookingDatabase.Descendants("entry") Select mytitle = feed.Element("title").Value, myrights = feed.Element("rights").Value For Each feed In feeds Dim myLabel As New Label myLabel.Text = feed.mytitle.First.ToString & " - " & feed.myrights.First.ToString PlaceHolder1.Controls.Add(myLabel) Next
I can't see what I have done wrong - but no results
Ideas?
解决方案
这篇关于Linq到XML查询不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!