zoukankan      html  css  js  c++  java
  • 修改datatable某列数据

     DataRow[] tmpDrs = null;
                                                DataTable tmpDrss = null;
                                                tmpDrs = excelData.Select(string.Format("PNO = '{0}'", Convert.ToInt32(excelData.Rows[r]["PNO"]))); //筛选数据
                                                tmpDrss = tmpDrs.CopyToDataTable();
                                                tmpDrs = tmpDrss.Select(string.Format("PNO = '{0}'", Convert.ToInt32(excelData.Rows[r]["PNO"]))); //筛选数据
                                                if (tmpDrs.Length != 0)
                                                {
                                                    for (int i = 0; i < tmpDrs.Length; i++)
                                                    {
                                                        DataRow dRow = tmpDrs[i];
                                                        dRow.BeginEdit(); //开始编辑
                                                        dRow["TEXT"] = SDitem.物探点号;
                                                        dRow.EndEdit(); //结束编辑
                                                        tmpDrss.AcceptChanges(); // 保存修改的结果
                                                        DataRow drcalc;
                                                        foreach (DataRow dr in tmpDrss.Rows)
                                                        {
                                                            drcalc = excelData.NewRow();
                                                            drcalc.ItemArray = dr.ItemArray;
                                                            excelData.Rows.Add(drcalc);
                                                            break;
                                                        }
                                                        break;
                                                    }
                                                }

  • 相关阅读:
    SpringMVC的DispatcherServlet加载过程
    SpringMVC-HandlerMapping和HandlerAdapter
    FactoryBean简介
    Spring IOC过程
    redis基本数据类型和对应的底层数据结构
    工厂模式
    springmvc工作原理
    Java虚拟机系列-Java类加载机制
    2019年10月21日 数据库sql只取最新一条的数据
    洛谷 P2606 [ZJOI2010]排列计数
  • 原文地址:https://www.cnblogs.com/nxj1997/p/13224668.html
Copyright © 2011-2022 走看看