cyrus_ Posted March 29, 2006 Share Posted March 29, 2006 hi,it is my problem:I fetch rss feeds from web and insert them into my table, and i do it every ten minuts. every time i must check 1- if the item already exists in my table if it exists then i must chech the publishdate if the publishdate has changed then the item must be updated. if the item exists and publishdate not changed so i have to chech if it is more than 20 days old, i must delete it if it is more than 20 days old otherwise no changing.2- if the item not exists i have to insert it into table.here is my code that checks SOME of my conditions but it inserts all items every time i fetch them.i need some code.//i load the items in xmldocument first and select all my items in the table and then i compare them one by one.xmlNodeList = XmlDoc.SelectNodes("rss/channel/item");DataSet DS = new DataSet();DS = RSSFWS.GetItems(ChannelId);if (DS.Tables["items"].Rows.Count > 0){DataRow DR;for (int i = 0; i < xmlNodeList.Count; i++){xmlNode = xmlNodeList;for (int j = 0; j < DS.Tables["items"].Rows.Count; j++){DR = DS.Tables["items"].Rows[j];if(DR["title"].ToString() != xmlNode["title"].InnerText){if (j == DS.Tables["items"].Rows.Count){AddItem(xmlNode, ChannelId); //here it should insert it if the item does not exist but it insert all of them.}}}}} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now