Solved

Limit Datatable Rows

Posted on 2006-07-17
2
408 Views
Last Modified: 2008-02-01
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
0
Comment
Question by:azyet24
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
Solar_Flare earned 500 total points
ID: 17125600
you can't limit the rows in the table, but you can delete any extra rows

while ds.tables(3).Rows.Count >3
   ds.tables(3).Rows.RemoveAt(3)
end while
0
 

Author Comment

by:azyet24
ID: 17126496
Yep that worked perfectly Solar Flare.  Thanks.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question