'Random' Orderby in webservice using LINQ To Entities
Posted
by MrDean
on Stack Overflow
See other posts from Stack Overflow
or by MrDean
Published on 2010-06-01T11:28:23Z
Indexed on
2010/06/01
11:33 UTC
Read the original article
Hit count: 161
Morning all
Now I know there is a reason to this odering but my tiny little brain can't get my head around it.
I am using a webservice to pull through data to a webp[age and have the following that is so far pulling data through from UUF1:
public string[] GetBuyer(string Memberkey)
{
try
{
WebService.EntitiesConnection buyer = new WebService.EntitiesConnection();
return buyer.tblProducts
.Where(p => p.MemberId == Memberkey)
.OrderBy(p => p.UnitUserfield1)
.Select(p => p.UnitUserfield1)
.Distinct()
.ToArray();
}
catch (Exception)
{
return null;
}
}
This works fine and pulls the data through but in a strange order. Where I would expect results of A B C D E F, it appears to be returning A C E B D F.
Could someone point out the error in my ways please?
© Stack Overflow or respective owner