Reputation: 13406
I have a DataTable
with many columns in it. I want to extract the entire 3rd column it in, and put the values in a string array. And I do NOT want to use LINQ as I'm using .net 2.0 Framework, which by default does not support LINQ.
So how can I do this without LINQ ?
Upvotes: 0
Views: 350
Reputation: 174299
string[] result = new string[datatable.Rows.Count];
int index = 0;
foreach(DataRow row in dataTable.Rows)
{
result[index] = row[2].ToString();
++index;
}
Upvotes: 2