Microsoft
70-516 · Question #222
70-516 Question #222: Real Exam Question with Answer & Explanation
Sign in or unlock 70-516 to reveal the answer and full explanation for question #222. The question stem and answer options stay visible for context.
Question
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You create a Database Access Layer (DAL) that is database-independent. The DAL includes the following code segment. (Line numbers are included for reference only.) 01 Shared Sub ExecuteDbCommand(connection As DbConnection) 02 If connection <> Nothing Then 03 Using connection 04 Try 05 connection.Open() 06 Dim command As DbCommand = connection.CreateCommand() 07 command.CommandText = "INSERT INTO Categories (CategoryName) VALUES ('Low Carb')" 08 command.ExecuteNonQuery() 10 Catch ex As Exception 11 Trace.WriteLine("Exception.Message: " + ex.Message) 12 End Try 13 End Using 14 End If 15 End Sub You need to log information about any error that occurs during data access. You also need to log the data provider that accesses the database. Which code segment should you insert at line 09?
Options
- ACatch ex As OleDbException
- BCatch ex As OleDbException
- CCatch ex As DbException
- DCatch ex As DbException
Unlock 70-516 to see the answer
You've previewed enough free 70-516 questions. Unlock 70-516 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.