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(涂聚文)
  • 相关阅读:
    Java NIO学习(Path接口、Paths和Files工具类的使用)
    Java 实现文件复制的不同方法
    Java NIO学习
    Properties工具类学习
    RandomAccessFile类学习
    Java管道流学习
    Java字符串流学习
    word里输入英文字母间距变宽,字体改变,怎么回事?
    js 和 css 中 不能使用 jsp 页面中一些 标签 和 java 代码等,应注意
    url地址 参数 带 参数 注意事项 , chain , redirect , redirectAction
  • 原文地址:https://www.cnblogs.com/geovindu/p/2060560.html
Copyright © 2011-2022 走看看