Last post Dec 17, 2010 03:51 AM by Qin Dian Tang - MSFT
Dec 15, 2010 10:23 AM|pankaj_upadhyay05|LINK
When i add the data using the C# Linq to XML code to an external XML file, only the file in the assembly folder is updated but i also want to update the file in project folder. Please tell me how to achieve this
I am using following code
private void saveButton_Click(object sender, RoutedEventArgs e)
XDocument xmlDoc = XDocument.Load(@"Transactions.xml");
xmlDoc.Element("Transactions").Add(new XElement("Transaction", new XElement("Buyer", buyerText.Text), new XElement("Serial", sText.Text)));
adding data to xml
Dec 15, 2010 12:24 PM|Martin_Honnen|LINK
Does using MapPath as in
save to the location you want to save to? If not then you need to explain more detail what kind of folders you have.
Dec 15, 2010 01:06 PM|pankaj_upadhyay05|LINK
I think we cant use MapPath in WPF applications , its only for web applications.
Well i am developing a WPF application for register maintenance and thinking of using xml as the database. As you might know, we need to set the Build Action property of the xml file to “Content” and the Copy to Output Directory to “Copy if newer”. By using
this a copy of xml file is created at the assembly directory and then accessed.
Now when i add a new XElement to an xml file by using the code stated in the problem above, the updation is done only in the assembly directly file and not in the file present in project directory.
Can the updates be done in the project directory file too or the updation is meant like this only......
Dec 17, 2010 03:51 AM|Qin Dian Tang - MSFT|LINK
Have a look at this article about working xml in wpf: