Implicit Transaction : SqlTransaction « ADO.Net « C# / CSharp Tutorial






using System;
using System.Data;
using System.Data.SqlClient;
using System.Transactions;
using System.Collections.Generic;
using System.Text;

    class Program
    {
        static void Main(string[] args)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                using (SqlConnection conn = new SqlConnection("data source=localhost; initial catalog=SampleDB; Integrated Security=SSPI;"))
                {
                    conn.Open();
                    SqlCommand cmd = conn.CreateCommand();
                    cmd.CommandText = "DELETE Employees";

                    cmd.ExecuteNonQuery();

                    int y = 1;
                    y -= 1;
                    Console.WriteLine("{0}", 1 / y);
                    
                }
                scope.Complete();
            }
        }
    }








32.28.SqlTransaction
32.28.1.Updating Data Using Transactions
32.28.2.the use of a transaction
32.28.3.Nested Implicit Transaction
32.28.4.Implicit Transaction
32.28.5.Explicit Transaction