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. You write
the following two DDL statements.
CREATE TABLE tblCustomers(
CustID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
CompanyName VARCHAR(50) NOT NULL,
ContactName VARCHAR(100) NOT NULL)
GO
CREATE TABLE tblCustomerOrders(
OrderID INT IDENTITY(1,1) NOT NULL,
CustID INT NOT NULL
FOREIGN KEY REFERENCES tblCustomers(CustID),
OrderDate DateTime NOT NULL)
When a user attempts to delete the data from the tblCustomers table during execution, the
application throws a SqlException exception.The application was designed without any
DataRelation objects.You need to successfully delete the data from the tblCustomers table.
What should you do?
A.
Use a DataRow to delete the records in the tblCustomers table.
B.
Use a DataAdapter to delete the records in the tblCustomers table.
C.
Update the DDL statement for the tblCustomers table to use the ON DELETE CASCADE option.
D.
Update the DDL statement for the tblCustomerOrders table to use the ON DELETE CASCADE option.
Explanation:
Since the tblCustomerOrders table references the tblCustomers table, the Cascade option needs to be specified for tblCustomerOrders rather than tblCustomers.