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

前端 未结 2 1608
心在旅途
心在旅途 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 05:56

    You should use [] brackets, like this :

    var rows = dt.Select("","[# of Students] desc");
    
    0 讨论(0)
  • 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");
    
    0 讨论(0)
提交回复
热议问题