public static int BeginTransaction(SqlConnection conn) { int index; if (Program.EnableRemoting && false) { index = mDataTableProxy.BeginTransaction(); } else { for (index = 0; index < int.MaxValue; ++index) { if (!mCommands.ContainsKey(index)) { break; } } if (conn.State == ConnectionState.Closed) { conn.Open(); } SqlCommand cmd = conn.CreateCommand(); SqlTransaction transaction = conn.BeginTransaction(); cmd.Transaction = transaction; mCommands[index] = cmd; } return(index); }