1 Replies - 737 Views - Last Post: 09 November 2009 - 01:09 PM Rate Topic: -----

#1 ho-ho  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 69
  • Joined: 04-May 09

Need help in writing data to a dataset in c#

Post icon  Posted 07 November 2009 - 10:55 AM

Hi, I am reading RSS from a URL and writing it in xml. Uptil here it works fine. Now I want to display the data from xml in a dataset. I can't figure this out since I don't have an xml path to put in a dataset. How can I accomplish this. Please help.(This is my first time working with dataset. Also do I drag and drop dataset control onto the form?)

string str = txtUrl.Text;
System.Xml.XmlDocument XMLDoc = new System.Xml.XmlDocument();

XMLDoc.Load("http://address.rss");
			XMLDoc.Load(str);
			NameTable table = new NameTable();
			XmlNamespaceManager nsManager = new XmlNamespaceManager(table);

			nsManager.AddNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
			nsManager.AddNamespace("item", "http://purl.org/rss/1.0/");
			nsManager.AddNamespace("dc", "http://purl.org/dc/elements/1.1/");
			System.Xml.XmlNodeList XMLItems = XMLDoc.DocumentElement.SelectNodes("//rdf:RDF/item:item", nsManager);

foreach (XmlNode currentItem in XMLItems)
			{
				// get the date
				this.richTextBox2.Text += "Date: " + currentItem.SelectSingleNode("dc:date", nsManager).InnerText + Environment.NewLine;
				// get the title and the link
				this.richTextBox2.Text += "Title: " + currentItem.SelectSingleNode("item:title", nsManager).InnerText + " - ";
				this.richTextBox2.Text += currentItem.SelectSingleNode("item:link", nsManager).InnerText + Environment.NewLine;

				// get the description
				this.richTextBox2.Text += "Description: " + currentItem.SelectSingleNode("item:description", nsManager).InnerText + Environment.NewLine + Environment.NewLine;

				this.Cursor = Cursors.Default;
   }



Is This A Good Question/Topic? 0
  • +

Replies To: Need help in writing data to a dataset in c#

#2 Grapevine  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 55
  • Joined: 26-October 09

Re: Need help in writing data to a dataset in c#

Posted 09 November 2009 - 01:09 PM

srry...i cant help much with this, but you can add a dataset to your toolbox then drag it to your form............. :/

This post has been edited by Grapevine: 09 November 2009 - 01:10 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1