joerattaz,
My apologies. I wasn't intending to discredit your post. You're absolutely correct: your solution is absolutely programmatic and scales fine. I wasn't being very precise in my terminology, and I assumed you'd get my meaning :(
What I ought to have said is that your solution is potentially difficult to maintain. Or, more correctly, your solution used as a solution to my problem would be difficult to maintain.
In my case, I'm trying to change the actual sort field of the orderby clause at runtime, not just the sort order. And, I'm dealing with a system to which we will be adding hundreds, maybe thousands of sort fields. So, I've been looking for a solution which wouldn't require a switch statement over each sortable field, ultimately because I don't want to have to add a new query each time I add a new sortable field: this is the maintenance problem I'm talking about. I wanted a way to write a single query, and then "pass" the sort field into it as a parameter. In this sense, your solution doesn't "scale" well for me, though technically, it's not a scaling issue but a maintenance issue. Also, when I said it wasn't "programmatic" I was referring to the parameterization of the orderby clause. Maybe it would be better so say that your solution wasn't "parameterized".... Your solution is certainly programmatic! In any case, hopefully now you get my point.
Again, apologies. And, thanks again for taking the time to post your solution.
Hawkeye Parker