The trouble with loops is, when you assign a value to a single variable inside one after the loop you only have a single value in it - the last one:
foreach (int x in Enumerable.Range(0, 9))
{
lastvalue = x;
}
So when your do the same thing with a datatable, the only result you get is always the last element in the table ...