Convert DataTable Column to String Array

Hi,

I am attempting to convert a DataTable Column into a String Array but find no easy way to do this.

Would anyone have suggestions?

Thanks in advance!

1 Like

Hi,

Try like this,

List(of string) = (From row in dt.AsEnumerable() Select Convert.Tostring(row(“ColumnName”))).ToList()

replace the “ColumnName” with your datatable column name or use index of the column.

12 Likes

Thank you sarathi125 for your response!

Your suggestion worked nicely. The only thing I changed was ToList() → ToArray()

3 Likes