Results 1 to 2 of 2

Thread: Data Set to text file.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    66

    Data Set to text file.

    Hi, i use this code

    Code:
     DataSet dsPubs = new DataSet();
                System.Xml.XmlDocument xdcDOC = new System.Xml.XmlDocument();
                // Read in XML from file
                dsPubs.ReadXml("http://www.nytimes.com/services/xml/rss/nyt/International.xml");
                // Bind DataSet to Data Grid
                grdData.DataMember = "item";
                grdData.DataSource = dsPubs;
                tmrDisplay.Enabled = true;
    To populate a dataset with the RSS info...How could i on a click of a button save this to text file?

    Like this is what i should look like:

    Title: The title colum

    Description - Description colum
    Thanks
    -FPP

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Data Set to text file.

    When you say text file do you mean a CSV? All you would need to do is open StreamWriter to write the file. Use a For loop to iterate over the Columns of the table to write the headers if you want them, then nested For loops to iterate over each column of each row to write out the values. Just make sure you put the comma between each pair of fields.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width