private void Insert_TransactionRollbackButton_Click(object sender, EventArgs e) { // Transaction using (var transaction = new SqlTransactionScope()) { try { // Insert this.InsertData(); // Throw throw new Exception(); // Complete transaction.Complete(); } catch { // ...... } } // Refresh this.RefreshData(); }
// Methods public void Complete() { // Complete _transactionScope.Complete(); }