Hello
How to convert DataTable to string array?
there are only one column in datatable.
Thank in advance.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Abhishek KumarPosted Feb 11, 2014, 11:47 AM
Hi,
DataTable dt=new DataTable ();
string[] array = dt("db_Column"))
.AsEnumerable()
.Select(row => row.Field
.ToArray();
Hope this will work.
Thanks.
VulpesPosted Feb 7, 2014, 10:37 AM
string[] array = (from DataRow dr in dt.Rows select dr[0].ToString()).ToArray();