You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET.
You write the following code segment.
SqlConnection sqlconn;
…
SqlDataAdapter custAdapter = new SqlDataAdapter("SELECT CustID, CompanyName FROM Sales.Customer", sqlconn);
SqlDataAdapter ordAdapter = new SqlDataAdapter("SELECT OrderID, CustID, OrderDate FROM "+ "Sales.SalesOrderDetail", sqlconn);
DataSet customerOrders = new DataSet();
custAdapter.Fill(customerOrders, "Customers");
ordAdapter.Fill(customerOrders, "Orders");
You need to ensure that the output of the customerOrders DataSet matches the XML schema of the following code fragment.
<CustomerOrders>
<Customers>
<CustID>ALFKI</CustID>
<CompanyName>Alfreds Futterkiste</CompanyName>
</Customers>
<Orders>
<OrderID>10643</OrderID>
<CustID>ALFKI</CustID>
<OrderDate>1997-08-25T00:00:00</OrderDate>
</Orders>
<Orders>
<OrderID>10692</OrderID>
<CustID>ALFKI</CustID>
<OrderDate>1997-10-03T00:00:00</OrderDate>
</Orders>
</CustomerOrders>
Which code segment should you add?
A.
DataRelation relation = customerOrders.Relations.Add
(
"CustOrders",
customerOrders.Tables["Customers"].Columns["CustID"],
customerOrders.Tables["Orders"].Columns["CustID"]
);
B.
DataRelation relation = customerOrders.Relations.Add
(
"CustOrders",
customerOrders.Tables["Orders"].Columns["CustID"],
customerOrders.Tables["Customers"].Columns["CustID"]
);
C.
DataRelation relation = customerOrders.Relations.Add
(
"CustOrders",
customerOrders.Tables["Customers"].Columns["CustID"],
customerOrders.Tables["Orders"].Columns["CustID"]
);
relation.Nested = true;
D.
DataRelation relation = customerOrders.Relations.Add
(
"CustOrders",
customerOrders.Tables["Orders"].Columns["CustID"],
customerOrders.Tables["Customers"].Columns["CustID"]
);
relation.Nested = true;