Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Limit Datatable Rows

Posted on 2006-07-17
2
Medium Priority
?
411 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Integration Management Part 2
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

971 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