try
{
XElement contactsFromFile = XElement.Load("App_Data/EmployeeFinList.xml");
var xEle = new XElement("Employees",
from emp in ListFromBasicPay
select new XElement("Employee",
new XAttribute("EmpID", emp.employee_personal_id),
new XElement("GrandTotal", emp.grandTotal),
new XElement("Housing", emp.housing),
new XElement("BasePay", emp.base_pay),
new XElement("XchangeRate", emp.Exchange_rate)));
xEle.Save("..\\changesetDB.xml");
Debug.WriteLine("Converted to XML");
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
I want to save the xml file in a folder i created in my project. I will then use that xml file created in my folder and read and write from it. Any idea how to do it?
xEle.Save("..\\changesetDB.xml");
normally you should be able to do the followingxEle.Save("changesetDB.xml");
but you should capture the Path of where you are trying to save this file