You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET.
You write the following code segment.
DataTable tblCustomer = new DataTable("Customer");
DataColumn parentCol= tblCustomer.Columns.Add("ID", typeof(int));
//Other columns added for tblCustomer
DataTable tblOrder = new DataTable("Order");
DataColumn childCol=tblOrder.Columns.Add("CustomerID",typeof(int));
//Other columns added for tblOrder
DataSet ds = new DataSet();
ds.Tables.Add(tblOrder);
ds.Tables.Add(tblCustomer);
The CustomerID column relates the Order DataTable to the Customer DataTable. You need to ensure that when you delete a row in the Customer DataTable, the corresponding row in the Order DataTable is deleted.
Which code segment should you use?
A.
ForeignKeyConstraint fCon = new ForeignKeyConstraint(parentCol, childCol);
fCon.DeleteRule = Rule.SetNull;
tblOrder.Constraints.Add(fCon);
B.
ForeignKeyConstraint fCon = new ForeignKeyConstraint(parentCol, childCol);
fCon.DeleteRule = Rule.Cascade;
tblOrder.Constraints.Add(fCon);
C.
ForeignKeyConstraint fCon = new ForeignKeyConstraint(parentCol, childCol);
fCon.DeleteRule = Rule.SetNull;
tblCustomer.Constraints.Add(fCon);
D.
ForeignKeyConstraint fCon = new ForeignKeyConstraint(parentCol, childCol);
fCon.DeleteRule = Rule.Cascade;
tblCustomer.Constraints.Add(fCon);