Which of the following code segments will he use to accomplish the task?

Posted by: Pdfprep Category: GSSP-.NET Tags: , ,

Allen works as a Software Developer for ABC Inc. The company uses Visual Studio.NET 2008 as its application development platform. Allen develops an application using .NET

Framework 3.5. The application connects to a SQL Server database using a SqlConnection object named Connection1. He creates some stored procedures in the database, which are used to update the data. Allen finds that sometimes, the update operation does not affect any row. He wants to add an error handling code to the application.

Which of the following code segments will he use to accomplish the task?
A . try
{
Connection1.open();
}
catch(DataException Myexcept)
{
//Error-handling code
}
B . try
{
Connection1.open();
}
catch(SqlException Myexcept)
{
//Error-handling code
}
C . try
{
Connection1.open();
}
catch(DBConcurrencyException Myexcept)
{
//Error-handling code
}

D . try
{
Connection1.open();
}
catch(InvalidCastException Myexcept)
{
//Error-handling code
}

Answer: C

Leave a Reply

Your email address will not be published.