HI All,
Can anyone help me on how to get distinct values from a column in a datatable to a list or array.
Thank you
HI All,
Can anyone help me on how to get distinct values from a column in a datatable to a list or array.
Thank you
@Sasi.lalo : it is throwing an error. can you please help
Hi @divyaag
Check this
Datatable dt = Datatable.DefaultView.Totable(true, list of column names)
Thanks
Ashwin.S
Using .net, you could do this:
dt1.AsEnumerable.Select(Function(r) r("columnname").ToString.Trim ).Distinct.ToArray
You can also manipulate it inside the Select if desired. Or, use .Where() before the select to only take rows that meet certain conditions.
Regards.
Hi ,
It can help you.
Regards
Balamurugan.S