DataTable dt = new DataTable();
dt.Columns.Add("id",typeof(Int32));
dt.Columns.Add("UserName", typeof(string));
dt.Columns.Add("UserPwd",typeof(string));
dt.Columns.Add("UserSex", typeof(string));
DataRow dr = dt.NewRow();
dr[0] = "1";
dr[1] = "admin";
dr[2] = "123";
dr[3] = "男";
dt.Rows.Add(dr);
DataTable newTable = dt.DefaultView.ToTable(false, new string[] { "id", "UserName"});
参考:http://tech.it168.com/KnowledgeBase/Articles/9/0/1/901f89bcfff296a73c7c4f91117cc177.htm
select 方法能根据条件获取行 无法获取列