如何以不区分大小写的方式对DataView进行排序?

时间:2022-12-09 19:24:20

I have a DataTable. I'd like to sort its default view by a column name 'city'. I'd like the sort to be case-insensitive.

我有一个DataTable。我想通过列名'city'对其默认视图进行排序。我希望这种情况不区分大小写。

Here is the code I have:

这是我的代码:

DataTable dt = GetDataFromSource();
dt.DefaultView.Sort = "city asc";

MyReport.DataSource = dt.DefaultView;

Thanks.

1 个解决方案

#1


Never mind. It's in the documentation.

没关系。它在文档中。

DataTable dt = GetDataFromSource();
dt.CaseSensitive = false;
dt.DefaultView.Sort = "city asc";

#1


Never mind. It's in the documentation.

没关系。它在文档中。

DataTable dt = GetDataFromSource();
dt.CaseSensitive = false;
dt.DefaultView.Sort = "city asc";