2012-06-20 3 views

답변

6

예. 다음을 할 수 있습니다 :

using (TransactionScope scope = new TransactionScope()) { 
    // Put the operations that you want to protect in a transaction here. 

    if (you_want_to_commit) { 
    scope.Complete(); 
    } 
    // Otherwise, it'll roll back when you exit the using block. 
} 
+0

내가 이해하는 방법 아무 것도 충돌하지 않으면 롤백이 수행되지 않습니다. 나는 커밋을하고 싶지만 곧 모든 것이 잘 되어도 롤백을하고 싶습니다. 그래서 기본적으로 Begin Tran .... RollBack Tran with SQL 쿼리입니다. – chobo2