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

namespace TxDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            TransactionOptions opt = new TransactionOptions();
            opt.IsolationLevel = IsolationLevel.ReadCommitted;
            using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, opt))
            using (SqlConnection conn = new SqlConnection("server=.;integrated security=sspi;database=pubs"))
            using (SqlCommand cmd = new SqlCommand("select * from authors", conn))
            {
                conn.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                }
                SqlConnection conn2 = new SqlConnection("server=.;integrated security=sspi;database=pubs");
                conn2.Open();
                ts.Complete();
            }
        }
    }
}
