I have two tables, movies
and categories
, and I get an ordered list by categoryID first and then by Name.
Using non-lambda, query-syntax LINQ, you can do this:
var movies = from row in _db.Movies
orderby row.Category, row.Name
select row;
[EDIT to address comment] To control the sort order, use the keywords ascending
(which is the default and therefore not particularly useful) or descending
, like so:
var movies = from row in _db.Movies
orderby row.Category descending, row.Name
select row;