How to access an column with special characters using DataTable.Select()?

前端 未结 2 1611
心在旅途
心在旅途 2021-01-26 05:19

I have a DataTable with column such as # of Students and would like to sort by this in descending order. Here is my code:

...
dt.Column         


        
2条回答
  •  一向
    一向 (楼主)
    2021-01-26 06:06

    You can use both [] or `` syntax. Both following snippets are correct:

    var rows = dt.Select("","`# of Students` desc");
    
    var rows = dt.Select("","[# of Students] desc");
    

提交回复
热议问题