What should you do?

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 that contains
the tblOrderDetails table.You plan to create an exception handler for the application.The
tblOrderDetails table has been created by using the following DDL statement. CREATE
TABLE tblOrderDetails(
[OrderID] int NOT NULL FOREIGN KEY REFERENCES
tblCustomerOrders(OrderID),
[ProductID] int NOT NULL,
[Qty] int NOT NULL,
[UnitPrice] float CONSTRAINT ckPositivePrice CHECK (UnitPrice >=0),
[Discount] float CONSTRAINT ckPositiveDiscount CHECK (Discount >=0))
You need to ensure that the users are notified when an update to the tblOrderDetails table
causes a violation of any constraint. What should you do?

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 that contains
the tblOrderDetails table.You plan to create an exception handler for the application.The
tblOrderDetails table has been created by using the following DDL statement. CREATE
TABLE tblOrderDetails(
[OrderID] int NOT NULL FOREIGN KEY REFERENCES
tblCustomerOrders(OrderID),
[ProductID] int NOT NULL,
[Qty] int NOT NULL,
[UnitPrice] float CONSTRAINT ckPositivePrice CHECK (UnitPrice >=0),
[Discount] float CONSTRAINT ckPositiveDiscount CHECK (Discount >=0))
You need to ensure that the users are notified when an update to the tblOrderDetails table
causes a violation of any constraint. What should you do?

A.
Catch the System.Exception exception.
Extract the message value.
Display the message value to the user.

B.
Catch the System.Data.SqlClient.SqlException exception.
Extract the message value.
Display the message value to the user.

C.
Catch the System.Exception exception.
Loop through all the error objects.
Capture the relevant data from each object.
Display the data to the user.

D.
Catch the System.Data.SqlClient.SqlException exception.
Loop through all the error objects.
Capture the relevant data from each object.
Display the data to the user.



Leave a Reply 0

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