I am writing a function that retrieves records from a database using LINQ to get IQueryable. This LINQ statement will pull out all records for active users for a certain period of time, and then spit the username, first name and last name on the Telerik RadGrid.
My problem is trying to get a distinctive value on the user id when you pull this data. I tried to rework this code to get the result. Here is an example of code that pulls all the data, while Distinct NOT does not work.
public static IQueryable GetActiveEmployees_Grid(string Period) { DataContext Data = new DataContext(); var Employees = (from c in DataSystem_Records where c.Period == Period orderby c.DataSystem_Employees.LName select c).Distinct(); return Employees; }
After applying the DataSource to my Grid, this returns the user 4 times, one instance for each record for this period.

Is there a way to apply Distinct to my LINQ function to make this work the way I intend it?
c # linq distinct
Lando Dec 17 '10 at 16:07 2010-12-17 16:07
source share