2009-05-19 1 views
2

こんにちは、私はTableAdapterのlinq orderbyAscending?

Dim spots = myDataTable.Where(Function(t) t.UserID = 1).OrderByDescending(Function(t) t.Title) 

によって返されたDataTableの結果をソートするために、次を使用していますことは、私も非常に同じデータテーブルをOrderByAscendingする必要があり、です。しかし、私が見る限り、それはオプションとして与えていない。私はそれを昇順にソートする方法があると確信しています。誰も私にどのように表示できますか?

答えて

6

OrderByは、昇順になります。

Dim spots = myDataTable.Where(Function(t) t.UserID = 1) _ 
         .OrderBy(Function(t) t.Title) 

または、あなたが第2の値でソートする必要がある場合は、使用ThenBy

Dim spots = myDataTable.Where(Function(t) t.UserID = 1) _ 
         .OrderByDescending(Function(t) t.Title) _ 
         .ThenBy(Function(t) t.OtherField)