DataTable dt = new DataTable(); DataColumn dc = new DataColumn("UserName", System.Type.GetType("System.String")); DataColumn dc1 = new DataColumn("UserPwd", System.Type.GetType("System.String")); dt.Columns.Add(dc); dt.Columns.Add(dc1); DataRow dr = dt.NewRow(); dr["UserName"] = "22"; dr["UserPwd"] = "33"; dt.Rows.Add(dr); var rownumber = dt.AsEnumerable().Where<DataRow>(C=>C["UserName"].ToString()=="22"); int row = rownumber.Count<DataRow>(); foreach ( DataRow en in rownumber) { Response.Write("User" + en["UserName"] + "pwd" + en["UserPwd"]); }
datatable 使用LAMBDA表达查询,过滤,布布扣,bubuko.com
原文:http://www.cnblogs.com/william-lin/p/3755028.html