Tuesday, 27 April 2010

Get distinct rows from DataTable

Found a method in data table object to get distinct rows:

DataTable dtTest = dtProduct.DefaultView.ToTable(true, new string[] { "PRODUCT", "NATURE", "TYPE" });

The first parameter has to be 'true' to get distinct rows, the second is the list of columns to return.

Cheers.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Shorts - week 3, 2022

Post with links to what I am reading: 1. A very good post on different aspects of system architecture: https://lethain.com/introduction-to-a...