In ADO.NET 2.0 there is a feature that allows you to create a new table containing the distinct entries from an existing table like below.
DataTable distinctTable = originalTable.DefaultView.ToTable( /*distinct*/ true)
It gets all the distinct rows from the original Table.
If you want only a single column we can use...
DataTable distinctTable = originalTable.DefaultView.ToTable( /*distinct*/ true, /*Column Name*/ "Col1")
DataTable distinctTable = originalTable.DefaultView.ToTable( /*distinct*/ true)
It gets all the distinct rows from the original Table.
If you want only a single column we can use...
DataTable distinctTable = originalTable.DefaultView.ToTable( /*distinct*/ true, /*Column Name*/ "Col1")
0 comments:
Post a Comment