• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 714
  • Last Modified:

geting distinct values of a column from dataview in LINQ

How can I get distinct values from a dataview for a column XYZ in LINQ
  • 2
1 Solution
Like this http://bytes.com/topic/net/answers/764762-distinct-rows-dataset-using-linq

   1. using System.Linq;
   3. DataAccess.RawDataDS ds = DataAccess.RawDataDSManagement.RawData;
   4. DataTable demoCriteria = ds.Tables["DemographicCriteria"];
   6. IEnumerable<string> query = (from row in demoCriteria.AsEnumerable()
   7.              select row.Field<string>("DemographicCode")).Distinct();
   9. foreach (string row in query)
  10. {
  11.     Console.WriteLine(row);
  12. }

countrymeisterAuthor Commented:
thanks for that, is there anyweay I can sort in asc order
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now