'Random' Orderby in webservice using LINQ To Entities
- by MrDean
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?