I have some problem with DataTable sorting.
I have some sorts in PowerBuilder script like status_abbr A
. In C# it will be status_abbr ASC
. But I don't how to interpret it in C# (DataTable Sort) such sort strings as Upper(era_supp) A
and case( status when 'P' then 'O' when 'Q' then 'O' else status ) A
.
Maybe someone can help me?
Use the DataTable.CaseSensitive Property: It indicates whether string comparisons within the table are case-sensitive. In your case you want it set to False.
You can alternatively add a calculated column in your DataTable and sort by that column. The column expression contains the mapping that you need.
A third option is to use the .OrderBy method, passing a lambda expression. You need to look this up in the Internet. There are plenty of example.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.