Hi All, can some one help me in extracting a specific column from a datatable and save it to a list
eg; sl.no Name city
1 Raju Hyd
2 Ravi Chennai
3 Ramu Pune
output to be name=[Raju,Ravi,Ramu]
Hi All, can some one help me in extracting a specific column from a datatable and save it to a list
eg; sl.no Name city
1 Raju Hyd
2 Ravi Chennai
3 Ramu Pune
output to be name=[Raju,Ravi,Ramu]
Hi @ppadarthi
Use the below LINQ:
nameList = (From row In dt.AsEnumerable() Select row.Field(Of String)("Name")).ToList()
nameList is of DataType System.Collections.Generic.List(System.String)
You can use below expression to print in Message box:
String.Join(", ", nameList)
Hope it helps!!
Hi @Parvathy it helps, Thanks
Solution shared by @Parvathy will work as expected
Just to add one point to avoid confusion
Make sure that the output variable for storing array value is of type List