#¬Ü¼Ð=Visual Studio 2005 #°Æ¼Ð=Visual Studio 2005·s¥\¯à¨t¦C¡]18¡^ #¤j¼Ð=.NET 2.0¥æ©ö³B²z·§Æ[ #§@ªÌ=¤å¹Ï¡þ¨H¬±§» ============= µ{¦¡1 try { using(TransactionScope scope = new TransactionScope()) { /* ¥æ©öµ{¦¡½X */ //¨S¦³¿ù»~«h»{¥i¥æ©ö scope.Complete(); } } catch(TransactionAbortedException e) { MessageBox.Show(e.Message); } catch { Trace.WriteLine("µLªk§¹¦¨¥æ©ö"); throw; } ================ ============= µ{¦¡2 using(TransactionScope scope1 = new TransactionScope()) { using(TransactionScope scope2 = new TransactionScope()) { scope2.Complete(); } scope1.Complete(); } ================ ============= µ{¦¡3 void firstMethod() { using(TransactionScope scope = new TransactionScope()) { /* ¥æ©öµ{¦¡½X */ secondMethod(); scope.Complete(); } } void secondMethod() { using(TransactionScope scope = new TransactionScope()) { /*¥æ©öµ{¦¡½X*/ scope.Complete(); } } ================ ============= µ{¦¡4 public enum TransactionScopeOption { Required, RequiresNew, Suppress } ================ ¡@¡@ ============= µ{¦¡5 using(TransactionScope scope1 = new TransactionScope()) { using(TransactionScope scope2 = new ƒ¨ TransactionScope( TransactionScopeOption.Required)) {...} using(TransactionScope scope3 = new ƒ¨ TransactionScope( TransactionScopeOption.RequiresNew)) {...} using(TransactionScope scope4 = new ƒ¨ TransactionScope( TransactionScopeOption.Suppress)) {...} ... } ================