liye

liye

博客园 首页 新随笔 联系 订阅 管理

DataTable MyDataTable = new DataTable();

  

            MyDataTable.Columns.Add(new DataColumn("学生编号", typeof(string)));
            MyDataTable.Columns.Add(new DataColumn("姓名", typeof(string)));
            MyDataTable.Columns.Add(new DataColumn("学校", typeof(string)));
            MyDataTable.Columns.Add(new DataColumn("联系电话", typeof(string)));
            MyDataTable.Columns.Add(new DataColumn("家庭住址", typeof(string)));

            DataRow dr;
            for (int i = 0; i <= 10; i++)
            {
                dr = MyDataTable.NewRow();
                dr["学生编号"] = Guid.NewGuid().ToString();
                dr["姓名"] = "222";
                dr["学校"] = "444";
                dr["联系电话"] = "555";
                dr["家庭住址"] = "666";

                MyDataTable.Rows.Add(dr);
            }

posted on 2010-05-18 18:04    阅读(6950)  评论(0编辑  收藏  举报