azyet24
asked on
Limit Datatable Rows
I have the following script that retrieves the RSS feed from a site and displays it on my site. I would like to limit the articles (rows) to 5. Is this possible to limit the datatable rows?
Code:
Sub Page_Load(sender as Object, e as EventArgs)
recentPosts.DataSource = GetRSSFeed("http://www.worthynews.com/news-editor/scripts/rss-news.php?nr=10")
recentPosts.DataBind()
End Sub
Function GetRSSFeed(strURL as String) as DataTable
'Get the XML data
Dim reader as XmlTextReader = New XmlTextReader(strURL)
'return a new DataSet
Dim ds as DataSet = New DataSet()
ds.ReadXml(reader)
Return ds.Tables(3)
End Function
Code:
Sub Page_Load(sender as Object, e as EventArgs)
recentPosts.DataSource = GetRSSFeed("http://www.worthynews.com/news-editor/scripts/rss-news.php?nr=10")
recentPosts.DataBind()
End Sub
Function GetRSSFeed(strURL as String) as DataTable
'Get the XML data
Dim reader as XmlTextReader = New XmlTextReader(strURL)
'return a new DataSet
Dim ds as DataSet = New DataSet()
ds.ReadXml(reader)
Return ds.Tables(3)
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER