zoukankan      html  css  js  c++  java
  • 数据写入DataTable C# 2005

    欢迎访问广告之家:http://www.adggs.com

    string xml_path = Server.MapPath("../xml/");
            if (!Directory.Exists(xml_path))
            {
                return;
            }

            DataTable dt = new DataTable();
            DataColumn name_xml = new DataColumn("xml_name");
            DataColumn path_xml = new DataColumn("xml_path");
            DataColumn last_time = new DataColumn("last_time");

            dt.Columns.Add(name_xml);
            dt.Columns.Add(path_xml);
            dt.Columns.Add(last_time);

            DirectoryInfo MyDir = new DirectoryInfo(xml_path);
          
            foreach (System.IO.FileInfo MyFile in MyDir.GetFiles("*.xml"))
            {
                DataRow dr = dt.NewRow();
                String FName = MyFile.Name;
                DateTime file_lastTime = MyFile.LastWriteTime;
                dr["xml_name"] = FName;
                dr["xml_path"] = xml_path + FName;
                dr["last_time"] = file_lastTime;
                dt.Rows.Add(dr);
            }

            DataView view = dt.DefaultView;
            view.Sort = "last_time desc";
            this.GridView_info.DataSource = view;
            this.GridView_info.DataBind();

     

     

     

     

    友情链接:遨游官方论坛:http://www.7v7.cn/?fromuid=177

  • 相关阅读:
    html 简介
    MySQL事务等了解知识
    MySQL—navicat&&练习&&pymysql
    MySQL查询表(一)
    作业
    MySQL约束&&表关系
    mysql数据类型
    初识mysql
    dll 原理解析
    又过了一天
  • 原文地址:https://www.cnblogs.com/binlunia/p/11267784.html
Copyright © 2011-2022 走看看