DataTable: Sort by multiple columns.

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi...

We are on Visual Basic .NET 2003 and i am using DataView to sort the
DataTable. However, we are facing problems with sorting the data based
on multiple columns.

The below statement to sort the table based on 1 column works
perfectly fine.

dvShiftData is a DataView
dsScheduleData is a DataSet

dvShiftData =
dsScheduleData.Tables("ShiftData").DefaultView.Sort("bytDay Asc")

But, when we try to sort that table based on 3 columns, it does not
allow us to do so.

dvShiftData =
dsScheduleData.Tables("ShiftData").DefaultView.Sort("bytDay Asc", "Job
Position Asc", "bytHour Asc")

Is there a way we can sort a DataTable based on multiple columns?

Thanks,
Hetal.

.



Relevant Pages

  • Re: ObjectDataSource and GridView SortExpression with multiple columns problem
    ... I've spent some time reading articles on gridview sorting when sort ... expression consists of multiple columns. ... SortDirection property used a SortDirection datatype and could contain ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Need help with Listview sort
    ... So I take it that there is no way to substitute the built in function (at ... > Except understand that the listview will only sort on one column at a ... > not on multiple columns. ...
    (microsoft.public.vb.controls)
  • Dataview Sort
    ... Apparently CF doesn't support sorting a dataview on multiple columns. ... I am using the Dataview to sort my data before binding it to a combo. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Sorting 1, 1A, 2, 2A, 3, 4, 4A, 4B . . .
    ... I have a spreadsheet with multiple columns and the ... column that I want to sort by contains sheet numbers. ... with two sorting options). ...
    (microsoft.public.excel.misc)
  • Re: splitting 1 column of data into multiple columns
    ... > I am trying to split up some data into multiple columns with part of the data ... > This needs to be done so I can sort by using the 2nd set of numbers. ... Dave Peterson ...
    (microsoft.public.excel.setup)