i am very new to this. Hope someone could help me suggest how to improve the code.
I have two tables where i need to get the SQL data and ouput it into XML format. I am using LINQ method. Below how the code looks like.
#region Database XML Methods private static void CreateDatabaseXml(string path) { tbchrDataContext db = new tbchrDataContext(); XDocument doc = new XDocument( // XML Declaration new XDeclaration("1.0", "utf-8", "yes"), // XML Root element to 3rd in nest new XElement(ns + "WMS", new XElement(ns + "Order", new XElement(ns + "Header", from a in db.T_ORDER_DETAILs select new XElement(ns + "RARefNum", a.RARefNum), new XElement (ns + "WMSCategory", from b in db.T_ORDER_HEADERs select b.Customer), new XElement (ns + "CustomerID", from a in db.T_ORDER_DETAILs select a.SupplierName)))) );
No comments:
Post a Comment