I want to convert a data table to an array. Do you know how to do it?
Hi @SUMEYYE_KARABIYIK ,
Could you let us know How exactly you would required to convert Datatable as an Array ? Do you want to convert a Single Column data to an Array ?
Do you mean a single column or multiple columns?
If you are looking to convert a single column:
DataTableName.AsEnumerable().Select(Function (a) a(“ColumnName”).ToString).ToArray()
Converting a multiple column data into an 2 dimensional array won’t benefit you in any way.
Thanx your answer.
I’m looking for multiple columns
As mentioned earlier, Could you let us know with an Example Data how would you require the Output format to be ?
Actually i have a data table which i want to its columns write to an excel file one after the other. This table have multiple columns and multiple rows. I thought converting to an array can help this.
hi @SUMEYYE_KARABIYIK ,
Can you provide sample data?
That would help us in helping you quickly.