Link to home
Start Free TrialLog in
Avatar of azyet24
azyet24Flag for United States of America

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
ASKER CERTIFIED SOLUTION
Avatar of Solar_Flare
Solar_Flare

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of azyet24

ASKER

Yep that worked perfectly Solar Flare.  Thanks.