zoukankan      html  css  js  c++  java
  • Csharp 两个DataTable或DataView互换,可以用来加密解密

            /// <summary>
            /// 涂聚文 geovindu.blog.163.com
            /// www.dusystem.com  www.dupcit.com
           /// 2011-05-28
          /// </summary>
            /// <param name="table"></param>
            /// <returns></returns>
            static DataTable GetDecTable(DataTable table)
            {
                if (!object.Equals(table, null))//
                {
                    DataTable tableDec = new DataTable();
                    tableDec.Columns.Add("序号", typeof(string));
                    tableDec.Columns.Add("员工编号", typeof(string));
                    tableDec.Columns.Add("姓名", typeof(string));
                    tableDec.Columns.Add("身份证号", typeof(string));
                    tableDec.Columns.Add("入职时间", typeof(DateTime));
                    foreach (DataRow row in table.Rows) // Loop over the rows.
                    {
                        tableDec.Rows.Add(row["序号"].ToString(), row["员工编号"].ToString(),  row["姓名"].ToString(),  row["身份证号"].ToString(), row["入职时间"].ToString());
    
                    }
                    return tableDec;
                }
                else
                {
                    return null;
                }
            }
            /// <summary>
            /// 涂聚文 締友計算機信息技術有限公司,捷為工作室,geovindu.blog.163.com
            /// www.dusystem.com  www.dupcit.com
           /// 2011-05-28
          /// </summary>
            /// <param name="view"></param>
            /// <returns></returns>
            static DataView getDecView(DataView view)
            {
                
                if (!object.Equals(view, null))
                {
                    
                    DataTable tableDec = new DataTable();
                    tableDec.Columns.Add("序号", typeof(string));
                    tableDec.Columns.Add("员工编号", typeof(string));
                    tableDec.Columns.Add("姓名", typeof(string));
                    tableDec.Columns.Add("身份证号", typeof(string));
                    tableDec.Columns.Add("入职时间", typeof(DateTime));
                    DataView dv = new DataView(tableDec);
                    //DataSet dset = new DataSet();
                    //dset = hr.HrestDataSet();
                    dv.AllowNew = true;
                    
                    //rowView["ProductName"] = "New Product Name";
                    //dv.AddNew();
                    //foreach (DataRow theRow in thisDataSet.Tables["Employee"].Rows)
                    //{
                    //    Console.WriteLine(theRow["ID"] + "\t" + theRow["FirstName"]);
                    //}
    
                    //DataView view = new DataView(ds.Tables[0]);
                    foreach (DataRowView drv in view)
                    {
                        DataRowView rowView = dv.AddNew();
                        rowView["序号"] = drv["序号"].ToString();
                        rowView["员工编号"] =drv["员工编号"].ToString();
                        rowView["姓名"] = drv["姓名"].ToString;
                        rowView["身份证号"] = drv["身份证号"].ToString();
                        rowView["入职时间"] = drv["入职时间"].ToString();
                    }
    
                    //// find the record for Rick
                    //view.RowFilter = "Name = 'Evy'";
                    //foreach (DataRowView drv in view)
                    //{
                    //    Console.WriteLine(drv["Name"].ToString());
                    //}
                    return dv;
                }
                else
                {
                    return null;
                }
            }
    
    哲学管理(学)人生, 文学艺术生活, 自动(计算机学)物理(学)工作, 生物(学)化学逆境, 历史(学)测绘(学)时间, 经济(学)数学金钱(理财), 心理(学)医学情绪, 诗词美容情感, 美学建筑(学)家园, 解构建构(分析)整合学习, 智商情商(IQ、EQ)运筹(学)成功.---Geovin Du(涂聚文)
  • 相关阅读:
    PHP获取指定的时间戳
    Thinkphp实现excel数据的导出
    ThinkPHP按月统计订单总金额
    PHP获取本月起始和终止时间戳
    ThinkPHP 判断一个更新操作是否成功
    js 通过浏览器直接打开应用程序(IOS,Android)并判断浏览器内核
    ThinkPHP 后台管理删除、编辑操作(通过数组传ID)
    PHP面向对象
    【转】Chrome调试鼠标悬停后出现的元素
    【重要】Selenium2+python自动化44-元素定位参数化(find_element)
  • 原文地址:https://www.cnblogs.com/geovindu/p/2060560.html
Copyright © 2011-2022 走看看