DataView / DataTable过滤和区分大小写 [英] DataView/DataTable Filtering and Case Sensitivity
问题描述
您好。我有一个DataSet,我转换为DataView以进行过滤,分离和排序,但小写和大写(虽然相同的值)并不明显。
这里是不能使DISTINCT的样本值
AdjustmentCode |调整
FLEXI-HOUSING | flexi housing
Flexi-housing |灵活住房
R-TRAVEL ALLOW |旅行津贴
R-Travel允许|旅行津贴
这是我的代码
Hi. I have a DataSet which I convert to DataView in order to do filtering, distinct and sorting, however lowercase and uppercase (though same value) is not being distinct.
Here is sample value that does not make DISTINCT
AdjustmentCode | Adjustment
FLEXI-HOUSING | flexi- housing
Flexi-housing | flexi- housing
R-TRAVEL ALLOW | travel allowance
R-Travel Allow | travel allowance
Here is my code
DataSet ds = new DatSet();
DataSet = dsFiltered = new DataSet();
DataTable dT = new DataTable();
ds = //put value from function
dT=ds.Tables[0];
dT.CaseSensitive=false;
DataView dView = dT.DefaultView;
dView.Sort = "Adjustment";
dT = dView.ToTable(true,"AdjustmentCode","Adjustment");
dsFiltered.Tables.Add(dT);
grid.DataSource = dsFiltered;
grid.DataBind();
我真的很感谢能帮助我的人!
谢谢!
I would really appreciate someone who could help me!
Thanks!
推荐答案
将DataTable的CaseSensitive属性设置为True
Set the CaseSensitive property of DataTable to True
dT.CaseSensitive=true;
这篇关于DataView / DataTable过滤和区分大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!