Solved

Limit Datatable Rows

Posted on 2006-07-17
2
391 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
2 Comments
 
LVL 15

Accepted Solution

by:
Solar_Flare earned 500 total points
Comment Utility
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
Comment Utility
Yep that worked perfectly Solar Flare.  Thanks.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now