zoukankan      html  css  js  c++  java
  • DataTable列修改

     /// <summary>
        /// 修改datatable列
        /// </summary>
        /// <param name="argDataTable"></param>
        /// <param name="newid"></param>
        /// <returns></returns>
        private DataTable UpdateDataTableEvaluation(DataTable argDataTable, string newid)
        {
            DataTable dtResult = new DataTable();
            //克隆表结构
            dtResult = argDataTable.Clone();

            foreach (DataColumn col in dtResult.Columns)
            {
                if (col.ColumnName == "age")
                {
                    //修改列类型
                    col.DataType = typeof(String);
                }
            }
            foreach (DataRow row in argDataTable.Rows)
            {
                DataRow rowNew = dtResult.NewRow();
                rowNew["Id"] = row["Id"];
                rowNew["Evaluation"] = row["Evaluation"];
                rowNew["Careergoal"] = row["Careergoal"];
                rowNew["ResumeId"] = newid;
                dtResult.Rows.Add(rowNew);
            }
            //返回
            return dtResult;
        }

  • 相关阅读:
    图片懒加载DEMO
    手写offset函数
    DOM
    jQuery笔记
    children和 childNodes辨析
    运算符...典型的三种用处
    Python中的数据结构---栈,队列
    手写call方法
    移动零元素--leetcode题解总结
    剑指 Offer 36. 二叉搜索树与双向链表
  • 原文地址:https://www.cnblogs.com/ybb521/p/2507925.html
Copyright © 2011-2022 走看看