Possible Duplicate:
How do I get a distinct, ordered list of names from a DataTable using LINQ?
This is my first question here. I am getting a list of distinct values for a drop-down list from my database like so:
var plocQ = (from m in db.SERVICE_NRS
orderby m.PLOC
select new { PlocID = m.PLOC, value = m.PLOC }).Distinct();
The ordering seems to have no effect, I have to do this:
var plocQ = (from m in db.SERVICE_NRS
select new { PlocID = m.PLOC, value = m.PLOC }).Distinct();
plocQ = from s in plocQ
orderby s.PlocID
select s;
I am wondering if this has something to do with LINQ or the database? I am a bit new to LINQ and have written too much SQL before. Any ideas?