You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET. The application connects to a Microsoft SQL Server 2005 database.
The database contains two tables named Customer and Address. The application uses a DataSet object that contains two DataTable objects.
The DataTable objects reference the Customer table and the Address table.
You write the following code segment.
DataSet CustAddressDS= new DataSet();
CustAddressDS.EnforceConstraints = true;
DataRelation custAddrRel = new DataRelation("CustAddrRel", custAddressDS.Tables["Customer"].Columns["CustomerID"], CustAddressDS.Tables["Address"].Columns["CustomerID"]);
CustAddressDS.Relations.Add(custAddrRel);
There are 200 records in the Customer table that are related to records in the Address table. You need to ensure that the application meets the following requirements:
It throws an exception when you attempt to delete related records.
It updates the related records in the Address table when you update records in the Customer table.
Which code segment should you use?
A.
custAddrRel.ChildKeyConstraint.DeleteRule = Rule.None;
B.
custAddrRel.ChildKeyConstraint.UpdateRule = Rule.None;
custAddrRel.ChildKeyConstraint.DeleteRule = Rule.Cascade;
C.
custAddrRel.ChildKeyConstraint.UpdateRule = Rule.Cascade;
custAddrRel.ChildKeyConstraint.DeleteRule = Rule.Cascade;
D.
custAddrRel.ChildKeyConstraint.UpdateRule = Rule.SetDefault;
custAddrRel.ChildKeyConstraint.DeleteRule = Rule.Cascade;