Unicode(缅甸)字符的DataTable.Select方法问题 [英] DataTable.Select Method Problem with Unicode (Myanmar) Characters
本文介绍了Unicode(缅甸)字符的DataTable.Select方法问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好!
在Asp.Net中搜索Unicode字符时,DataTable的选择方法出现问题. DataTable.Select()无法使用Unicode字符.这是我的代码........
Hello!
I have a problem with Select Method of DataTable when search Unicode Characters in Asp.Net. DataTable.Select() can''t work with Unicode Characters. And Here is My Code........
DataRow[] dr = dt.Select("Name LIKE '%" + txtSearch.Text + "%'");
dt是DataTable,而txtSearch.Text包含Unicode字符.
dt is DataTable and txtSearch.Text Contains Unicode Characters. How can I search Unicode Characters?
推荐答案
如果使用.NET 3.5
或更高版本,那么我认为LINQ
是更好的选择,因为Culture aware
比较可以用LINQ
制成以从DataTable
获取所需的行.
如果要使用.NET 2.0
,则将使用DataTable.Select
方法,并且DataTable.Select
方法不具有文化意识,如此处报道
DataTable.Select()方法不支持文化 [ ^ ]
在此给出了解决此问题的方法
DataTable的字符串比较问题 [ ^ ]
请参见.可能会有所帮助.
If.NET 3.5
or above is used then I thinkLINQ
can be a better alternative asCulture aware
comparison can be made withLINQ
to get the desired rows from theDataTable
.
If.NET 2.0
is to be used thenDataTable.Select
method is to be used and theDataTable.Select
method is not culture aware as reported here
DataTable.Select() method is not culture-aware[^]
A work around for this issue is given here
Problem on DataTable''s string comparison [^]
Please see. It may be helpful.
这篇关于Unicode(缅甸)字符的DataTable.Select方法问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文