PrepAway - Latest Free Exam Questions & Answers

You need to ensure that the application meets the following requirements: • There is a SqlConnection named c

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application connects to two different Microsoft SQL Server 2008 database servers named Serverl
and Server2. A string named sqllcontains a connection string to Serverl. A string named sql2contains
a connection string to Server2.
01 Using scope As New 02
03 Using cnl As New SqlConnection(sqll)
04 Try 05
06 Catch ex As Exception
07 End Try
08 End Using
09 scope.Complete()
10 End Using
You need to ensure that the application meets the following requirements:
• There is a SqlConnection named cn2 that uses sql2.
• The commands that use cnl are initially enlisted as a lightweight transaction.
• The cn2 SqlConnection is enlisted in the same TransactionScope only if commands executed
by cnl do not throw an exception.
What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Insert the following code segment at line 02.
Transacti onScope (TransactionScopeOption. RequiresNew)
Insert the following code segment at line 05.
cnl. Open ()
Using cn2 As New SqlConnection(sql2) Try
cn2 .OpenO Catch ex As Excepcion
End Try
End Using

B.
Insert the following code segment at line 02.
TransaccionScope(TransaccionScopeOption.Suppress)
Insert the following code segment at line 05.
cnl .Open()
Using cn2 As New SqlConnection(sql2) Try
cn2-Open()
Catch ex As Exception
End Try
End Using

C.
Insert the following code segment at line 02.
TransactionScope(TransactionScopeOption.Suppress)
Insert the following code segment at line 05.
Using cn2
As New
SqlConnection(sql2)
Try
cn2 . Open()
cnl .Open ()

Catch ex As Exception E
nd Try
End Using

D.
Insert the following code segment at line 02.
TransactionScope(TransactionScopeOption.RequiresNeW)
Insert the following code segment at line 05.
Using cn2 As New SqlConnection(sql2)
Try
cn2 .Open ( )
cnl. Open {}
Catch ex As Exception
End Try
End Using

Explanation:
http://msdn.microsoft.com/en-us/library/ms172152(v=vs.90).aspx


Leave a Reply