Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

asp.net: append xml file from dataset

  • 12-11-2006 11:40AM
    #1
    Registered Users, Registered Users 2 Posts: 872 ✭✭✭


    Hi,

    I have an xml file that lists a date and description:

    <holiday>
    <Date>12/11/2006</Date>
    <Description>10:30</Description>
    </holiday>

    im trying to add in another date and description to the file:

    [PHP]

    //dataset stores xml info
    DataSet ds = new DataSet();

    //read the existing file
    ds.ReadXml(@c:\inetpub\wwwroot\Web\availability.xml);

    //the following code just replaces the first entry in xml file
    ds.Tables[0].Rows[0]["Date"] = "date";
    ds.Tables[0].Rows[0]["Description"] = "description";

    //update file
    ds.WriteXml(@c:\inetpub\wwwroot\Web\availability.xml,XmlWriteMode.IgnoreSchema);[/PHP]


    instead of replacing first entry i want to append new info onto the existing file. Any ideas !

    Thanks


Comments

  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    Add a new row to the dataset before you write it's xml to file.


Advertisement