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

namespace GetBigTable
{
	class Class2
	{
		public static void Main()
		{
			using (SqlConnection conn = new SqlConnection("server=.\\sqldev01;integrated security=sspi;database=pubs"))
			using (SqlCommand cmd = new SqlCommand("select * from bigtable", conn))
			{
				SqlDataReader rdr = null;
				SqlTransaction tx = null;

				conn.Open();
				tx = conn.BeginTransaction(IsolationLevel.Serializable);
				cmd.Transaction = tx;
				rdr = cmd.ExecuteReader();

                int i = 0;
                while (rdr.Read())
                {
                    Console.WriteLine("Read row {0}", rdr[0]);
                    i++;
                }
				rdr.Close();
                Console.WriteLine(i);
				tx.Commit();
			}

		}
	}
}
