Microsoft
70-516 · Question #170
You use Microsoft .NET Framework 4.0 to develop an application. You write the following code to update data in a Microsoft SQL Server 2008 database. (Line numbers are included for reference only.)…
The correct answer is C. using (SqlConnection conn = new SqlConnection(connString)). See the full explanation below for the reasoning.
Question
You use Microsoft .NET Framework 4.0 to develop an application. You write the following code to update data in a Microsoft SQL Server 2008 database. (Line numbers are included for reference only.) 01 private void ExecuteUpdate(SqlCommand cmd, string connString, string updateStmt) 02 { 03 ... 04 } You need to ensure that the update statement executes and that the application avoids connection leaks. Which code segment should you insert at line 03?
Options
- ASqlConnection conn = new SqlConnection(connString);
- Busing (SqlConnection conn = new SqlConnection(connString))
- Cusing (SqlConnection conn = new SqlConnection(connString))
- DSqlConnection conn = new SqlConnection(connString);
How the community answered
(47 responses)- A2% (1)
- B11% (5)
- C83% (39)
- D4% (2)
Community Discussion
No community discussion yet for this question.