Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Good news everyone! The Boards.ie Subscription service is live. See here: https://subscriptions.boards.ie/

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