• 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;
        }

  • 相关阅读:
    简单工厂模式_C#_设计模式
    单例模式_C#设计模式
    快速排序_排序算法_算法
    关于缓存C#
    网络编程的4种IO模型
    一些自己总结
    驱动漏洞中的__try和ProbeForRead
    poj2318
    poj1113
    poj 1904
  • 原文地址:https://www.cnblogs.com/ybb521/p/2507925.html
Copyright © 2020-2023  润新知