private void RunSqlCommands(Stack<SqlCommand> sqlCommandStack)
 {
     while (sqlCommandStack.Count != 0)
     {
         SqlCommand cmd = sqlCommandStack.Pop();
         using (SqlConnection cn = new SqlConnection(this.m_ConnectionString))
         {
             cn.Open();
             cmd.Connection = cn;
             cmd.ExecuteNonQuery();
             Console.WriteLine(cmd.CommandText);
         }
     }
 }
Esempio n. 2
0
 private void RunSqlCommands(Stack<SqlCommand> sqlCommandStack, SqlConnection cn, SqlTransaction trans)
 {
     while (sqlCommandStack.Count != 0)
     {
         SqlCommand cmd = sqlCommandStack.Pop();
         cmd.Connection = cn;
         cmd.Transaction = trans;
         cmd.ExecuteNonQuery();
     }
 }