Hi Team,
One of the Datatable having one columns “AllUserName” has multiple name in a single cell.
So that i want to write a unique name as showing some sample input and expected output details
Thanks
Shyam
Hi Team,
One of the Datatable having one columns “AllUserName” has multiple name in a single cell.
So that i want to write a unique name as showing some sample input and expected output details
Thanks
Shyam
Try this:
outputDataTable = (From row In inputDataTable.AsEnumerable()
Let uniqueNames = String.Join(",", row.Field(Of String)("AllUserName").Split(",").Distinct())
Select outputDataTable.Rows.Add(uniqueNames)).CopyToDataTable()
Try this
Code:
(From row In DT.AsEnumerable()
Let uniqueNames = String.Join(",", row("AllUserName").ToString().Split(","c).Select(Function(name) name.Trim()).Distinct())
Select DT.Clone.Rows.Add({uniqueNames})).CopyToDataTable()
I/P:
O/P:
Hope this helps!!
Thanks its working fine…
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.