I'm just learning about the nested property of a DataRelation.I used this as an example:http://msdn.microsoft.com/en-us/library/7sfkwf9s(v=vs.71).aspx#Y650Dataset is CustomerOrders. Parent datatable is Customers. Child datatable is Orders. Relationship is built on CustomerID.XML output of datset is below (copied from web page above):\[code\]<CustomerOrders> <Customers> <CustomerID>ALFKI</CustomerID> <Orders> <OrderID>10643</OrderID> <CustomerID>ALFKI</CustomerID> <OrderDate>1997-08-25T00:00:00</OrderDate> </Orders> <Orders> <OrderID>10692</OrderID> <CustomerID>ALFKI</CustomerID> <OrderDate>1997-10-03T00:00:00</OrderDate> </Orders> <CompanyName>Alfreds Futterkiste</CompanyName> </Customers>...\[/code\]Note the position of element CompanyName. When I try to recreate this same example on my own I get a different order of elements. All of the parent table's elements are listed first, then the nested child table elements follow.Example here:\[code\]<CustomerOrders> <Customers> <CustomerID>ALFKI</CustomerID> <CompanyName>Alfreds Furtterkiste</CompanyName> <Orders> <OrderID>10643</OrderID> <CustomerID>ALFKI</CustomerID> <OrderDate>1997-08-25T00:00:00-06:00</OrderDate> </Orders> <Orders> <OrderID>10692</OrderID> <CustomerID>ALFKI</CustomerID> <OrderDate>1997-10-03T00:00:00-06:00</OrderDate> </Orders> </Customers>...\[/code\]I'm trying to figure out what dictates the position of the elements. Why does CompanyName come after the Orders elements in the MSDN example, but before Orders in my example?Here is the code I'm using:\[code\]static void Main(){ DataSet dsCustomerOrders = new DataSet("CustomerOrders"); DataTable dtCustomers = new DataTable("Customers"); DataColumn[] dcCustomers = new DataColumn[2]; dcCustomers[0] = new DataColumn("CustomerID",System.Type.GetType("System.String")); dtCustomers.Columns.Add(dcCustomers[0]); dcCustomers[1] = new DataColumn("CompanyName",System.Type.GetType("System.String")); dtCustomers.Columns.Add(dcCustomers[1]); DataRow drEmplRecord = dtCustomers.NewRow(); drEmplRecord["CustomerID"] = "ALFKI"; drEmplRecord["CompanyName"] = "Alfreds Furtterkiste"; dtCustomers.Rows.Add(drEmplRecord); drEmplRecord = dtCustomers.NewRow(); drEmplRecord["CustomerID"] = "ANATR"; drEmplRecord["CompanyName"] = "Ana Trujillo Emparedados y helados"; dtCustomers.Rows.Add(drEmplRecord); DataTable dtOrders = new DataTable("Orders"); DataColumn[] dcOrders = new DataColumn[3]; dcOrders[0] = new DataColumn("OrderID", System.Type.GetType("System.Int32")); dtOrders.Columns.Add(dcOrders[0]); dcOrders[1] = new DataColumn("CustomerID", System.Type.GetType("System.String")); dtOrders.Columns.Add(dcOrders[1]); dcOrders[2] = new DataColumn("OrderDate", System.Type.GetType("System.DateTime")); dtOrders.Columns.Add(dcOrders[2]); DataRow drOrder = dtOrders.NewRow(); drOrder["OrderID"] = "10643"; drOrder["CustomerID"] = "ALFKI"; drOrder["OrderDate"] = "1997-08-25T00:00:00"; dtOrders.Rows.Add(drOrder); drOrder = dtOrders.NewRow(); drOrder["OrderID"] = "10692"; drOrder["CustomerID"] = "ALFKI"; drOrder["OrderDate"] = "1997-10-03T00:00:00"; dtOrders.Rows.Add(drOrder); drOrder = dtOrders.NewRow(); drOrder["OrderID"] = "10308"; drOrder["CustomerID"] = "ANATR"; drOrder["OrderDate"] = "1996-09-18T00:00:00"; dtOrders.Rows.Add(drOrder); dsCustomerOrders.Tables.Add(dtCustomers); dsCustomerOrders.Tables.Add(dtOrders); DataColumn colParent = dsCustomerOrders.Tables["Customers"].Columns["CustomerID"]; DataColumn colChild = dsCustomerOrders.Tables["Orders"].Columns["CustomerID"]; DataRelation drCustomers_Orders = new DataRelation("CustomerID", colParent, colChild); drCustomers_Orders.Nested = true; //causes nesting when written to XML dsCustomerOrders.Relations.Add(drCustomers_Orders); dsCustomerOrders.WriteXml(@"C:dsCustomerOrders.xml");}\[/code\]}