try { using (TransactionScope ts = new TransactionScope()) { //執行的程式碼 ts.Complete(); } } catch (Exception ex) { throw; } http://www.jiniannet.com/Article/I11409120400347