Which code segment should you insert at line 06?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. The application has two DataTable objects that reference the Customers and Orders tables in the database. The application contains the following code segment. (Line numbers are included for reference only.)

01 Dim customerOrders As New DataSet()
02 customerOrders.EnforceConstraints = True
03 Dim ordersFK As New ForeignKeyConstraint(“ordersFK”,
04 customerOrders.Tables(“Customers”).Columns(“CustomerID”),
05 customerOrders.Tables(“Orders”).Columns(“CustomerID”))
06
07 customerOrders.Tables(“Orders”).Constraints.Add(ordersFK)

You need to ensure that an exception is thrown when you attempt to delete Customer records that have related Order records. Which code segment should you insert at line 06?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. The application has two DataTable objects that reference the Customers and Orders tables in the database. The application contains the following code segment. (Line numbers are included for reference only.)

01 Dim customerOrders As New DataSet()
02 customerOrders.EnforceConstraints = True
03 Dim ordersFK As New ForeignKeyConstraint(“ordersFK”,
04 customerOrders.Tables(“Customers”).Columns(“CustomerID”),
05 customerOrders.Tables(“Orders”).Columns(“CustomerID”))
06
07 customerOrders.Tables(“Orders”).Constraints.Add(ordersFK)

You need to ensure that an exception is thrown when you attempt to delete Customer records that have related Order records. Which code segment should you insert at line 06?

A.
ordersFK.DeleteRule = Rule.SetDefault

B.
ordersFK.DeleteRule = Rule.None

C.
ordersFK.DeleteRule = Rule.SetNull

D.
ordersFK.DeleteRule = Rule.Cascade



Leave a Reply 0

Your email address will not be published. Required fields are marked *