h1

Retrieving Unique Values from a DataTable in .NET

March 25, 2009

The easiest way to return a new table that has only the unique values from the original table is as follows:

DataTable distinctTable = originalTable.DefaultView.ToTable(true, “FieldName”);
Thus “distinctTable” will contain unique values!!! :) Have fun!

Leave a Comment