从DataView的列中选择不同的值. [英] Select distinct values from a column in DataView.

查看:92
本文介绍了从DataView的列中选择不同的值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

我必须从DataView的列中选择不同"值.
我也想从数据视图中删除空行....


请朋友帮我...

在此先感谢

Dear friends,

I have to select "Distinct" Values from a column in DataView.
Also I want to remove empty rows from the dataview....


Please friends help me ...

Thanks in advance

推荐答案



您可以为此使用Lambda表达式.
假设要从网格中获取的数据为int类型.
然后,初始化List< int> ;,例如 List< int> list =新列表< int>
然后将列的所有行添加到此列表.
然后尝试 list.Distinct().ToList()
此列表将提供所需的不同值

快乐编码
:)
Hi,

You can use Lambda Expression for this.
Suppose the data you want to get from the grid is of type int.
Then initialize a List<int>, like List<int> list = new List<int>
Then add all the rows of the column to this list.
Then try list.Distinct().ToList()
This list will give the required distinct values

Happy Coding
:)


这篇关于从DataView的列中选择不同的值.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆