Tuesday, March 1, 2011

C# - How do I sort a DataTable by date.

I have a datatable that has a date column, but I am stumped as to how to sort it by that column. Any suggestions?

From stackoverflow
  • DataView view = DataTable.DefaultView;
    view.Sort = "DateColumn";
    
    Brad : That seems to sort it like a text field and not a date
    Jason Jackson : Is the column text?
    Brad : Yes it was...I changed it to DateTime

0 comments:

Post a Comment