TransactionScope多使用於批次更新資料的效果
using System.Transactions;
using (TransactionScope scope = new TransactionScope())
{
query.ExecuteNonQuery("Insert TABLE_HISTORY Select 'TEST','TEST','TEST','TEST',getdate()");
query.ExecuteNonQuery("Insert TABLE_HISTORY Select 'TEST02','TEST02','TEST02','TEST02',getdate()");
scope.Complete();
}
參考:https://edwardkuo.imas.tw/paper/2016/05/01/Net/2016/2016-05-01/