PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are creating a Windows Forms application that includes the database helper methods UpdateOrder and UpdateAccount. Each method wraps code that connects to a Microsoft SQL Server 2005 database, executes a Transact-SQL statement, and then disconnects from the database. You must ensure that changes to the database that result from the UpdateAccount method are committed only if the UpdateOrder method succeeds. You need to execute the UpdateAccount method and the UpdateOrder method. Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
Using ts As New TransactionScope() UpdateOrder() UpdateAccount() ts.Complete()End Using

B.
Using ts1 As New TransactionScope() UpdateOrder() Using ts2 As New TransactionScope(TransactionScopeOption.RequiresNew) UpdateAccount() ts2.Complete() End Using ts1.Complete()End Using ts1.Complete();

C.
Using ts1 As New TransactionScope() UpdateOrder() Using ts2 As New TransactionScope(TransactionScopeOption.RequiresNew) UpdateAccount() ts2.Complete() End Using ts1.Complete()End Using

D.
Using ts As New TransactionScope(TransactionScopeOption.RequiresNew) UpdateOrder()End UsingUsing ts As New TransactionScope(TransactionScopeOption.Required) UpdateAccount() ts.Complete()End Using


Leave a Reply