Without Looping Comma Separated String DataTable Column in Vb.net /C#

Step 1: Import NameSpace

Imports System.Linq

Step 2: Use Function

dt is returning value in datatable.

  1. Public Function CommaSeparated()  
  2. Dim strName As String = String.Empty  
  3. Try  
  4. strName += String.Join(",", (From row In dt.Rows Select CType(row.Item("columnname"), String)).ToArray)  
  5. Console.writeline(strName)  
  6. Catch(Exception ex)  
  7. Throw New(ex.message)  
  8. End Function