获取DataTable某一列所有值,存到List

来源:互联网 发布:用java编写99乘法表 编辑:程序博客网 时间:2024/06/05 13:10

有时候我们需要取出DataTable中的某一列,存到一个List中进行操作

List ls = new List (); //存放你一整列所有的值 DataTable dt ; //你的DataTableforeach (DataRow dr in dt.Rows) {       ls.Add(dr["列名"]); }

                                             
0 0