Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7430239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:06:24+00:00 2026-05-29T09:06:24+00:00

i am getting Rss Feed from my DB but i am getting all feeds

  • 0

i am getting Rss Feed from my DB but i am getting all feeds and everytime when i run my code in DB Data is adding.Show i need to show Rss Feed in Count and how to ignore the already added feed in DB and in source code i am showing in Repeater control

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using System.Text;
using System.Data.SqlClient;
using System.Web.UI.HtmlControls;
using System.Web.Security;
using System.Data;

public partial class _Default : System.Web.UI.Page
{
    RssDC rssDC = new RssDC();
    RssBAL rssBAL = new RssBAL();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) { 
        //List<RSSFeed> rssFeedList = new List<RSSFeed>();
        //var item = BlogFeeds("http://rss.cnn.com/rss/edition_americas.rss",  3, rssFeedList);
        //var item2 = BlogFeeds("http://feeds.bbci.co.uk/news/rss.xml?edition=int#",  3, rssFeedList);
        //var item3 = BlogFeeds("http://feeds.reuters.com/reuters/Election2012", 3, rssFeedList);
        //Repeater1.DataSource = item3;
        //Repeater1.DataBind();

        BlogFeeds("http://rss.cnn.com/rss/edition_americas.rss", 3);

        fillRssFeeds();
        }

    }

    private void fillRssFeeds()
    {        
        DataSet ds = new DataSet();
        ds = rssBAL.GetRssFeeds(rssDC);

        Repeater1.DataSource = ds;
        Repeater1.DataBind();
    }
    protected void BlogFeeds(string url,  int count)
    {

        try
        {

            RssDC rssDC = new RssDC();
            XmlDocument xmldoc = new XmlDocument();
            XmlNodeList items = default(XmlNodeList);
            xmldoc.Load(url);
            items = xmldoc.SelectNodes("/rss/channel/item");

            // use XPath to get only items

            foreach (XmlNode item1 in items)
            {

                foreach (XmlNode node1 in item1.ChildNodes)
                {
                    if (node1.Name == "title")
                    {
                        rssDC.Title = node1.InnerText;
                    }
                    else if (node1.Name == "link")
                    {
                        rssDC.Link = node1.InnerText;
                    }
                    else if(node1.Name == "guid")
                    {
                        rssDC.RSS_ID = node1.InnerText;
                    }
                    else if (node1.Name == "description")
                    {
                        rssDC.Description = node1.InnerText;
                    }
                    else if (node1.Name == "pubDate")
                    {
                        rssDC.DatePublished = node1.InnerText;
                    }


                }
                rssDC = RssBAL.AddRssFeed(rssDC);


            }

        }
        catch (Exception eax)
        {
            //return;
        }

        //return rssFeedList;
        //Repeater1.DataSource = rssFeedList;
        //Repeater1.DataBind();
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:06:25+00:00Added an answer on May 29, 2026 at 9:06 am

    If you only want a certain number of articles retrieved, based on the input parameter you supply from BlogFeeds(), you could try something like this:

    foreach (XmlNode item1 in items)
                {
                    int currentIterationIndex = 0;
    
                    foreach (XmlNode node1 in item1.ChildNodes)
                    {
                        if(currentIterationIndex >= count -1)
                        {
                            continue; //or break; would probably be better.
                        }
    
                        if (node1.Name == "title")
                        {
                            rssDC.Title = node1.InnerText;
                        }
                        else if (node1.Name == "link")
                        {
                            rssDC.Link = node1.InnerText;
                        }
                        else if(node1.Name == "guid")
                        {
                            rssDC.RSS_ID = node1.InnerText;
                        }
                        else if (node1.Name == "description")
                        {
                            rssDC.Description = node1.InnerText;
                        }
                        else if (node1.Name == "pubDate")
                        {
                            rssDC.DatePublished = node1.InnerText;
                        }
    
                        currentIterationIndex += 1;
                    }
                    rssDC = RssBAL.AddRssFeed(rssDC);
    
    
                }
    
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get some data from a RSS feed but I am
I want to create my own RSS/XML feed. I fetch data from the database
i have wrote an app getting rss feed from the website of my university.in
I am getting news from Yahoo using an RSS feed, using: XML.load(http://finance.yahoo.com/rss/topstories) Yea this
I want to track how much traffic I'm getting on an RSS feed that
i am creating rss reader application with php.it is basicly getting rss url's from
I've got an Android activity which grabs an RSS feed from a URL, and
I need to emulate a real http request via cfhttp. I was getting rss
Hay, i'm trying to parse an RSS feed from a wordpress blog. So far
I am trying to parse an RSS feed with feedparser. The below code snipped

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.