SqlTransaction trans = null;
                connection.Open();
                trans = connection.BeginTransaction();
                try
                {
                    SqlCommand[] cmd = new SqlCommand[tabTemp.Rows.Count];
                    int count = -1;
                    for (int index = 0; index < tabTemp.Rows.Count; index++)
                    {
                        count = index;
                        cmd[index] = new DataLib().CreateTranSqlCommand(tabTemp.Rows[index][0].ToString(), connection, (SqlParameter[])tabTemp.Rows[index][1], (bool)tabTemp.Rows[index][2]);
                        cmd[index].ExecuteNonQuery();
                    }
                    currRow = count;
                    trans.Commit();
                    connection.Close();
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    throw new Exception(ex.Message, ex);
                }               执行以上代码到cmd[index].ExecuteNonQuery();的时候,有异常信息,提示“如果分配给命令的连接位于本地挂起事务中,ExecuteNonQuery 要求命令拥有事务。命令的 Transaction 属性尚未初始化。”请问这是什么原因,要改动哪里的代码?