首先引用使名空间:
using System.Transactions;
然后写入代码:
using (TransactionScope ts = new TransactionScope()) { data.SubmitChanges(); ts.Complete(); }