Manchu
(MK)
1
Hi all ,
Can you help me with the expression to get the header of the DataTable and assign it to StringArray in c# code .
Eg:
I just want value from first column
I used
DT.Rows[1].ItemArray.Select(x => x.ToString()).ToArray(); which is giving the first row in the DT not the header .
Thanks,
Manchu.
Parvathy
(PS Parvathy)
2
Hi @Manchu
Try this:
string[] headers = DT.Columns.Cast<DataColumn>().Select(column => column.ColumnName).ToArray();
Manchu
(MK)
3
Thanks Parvathy , it worked.
1 Like
system
(system)
Closed
4
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.