D
deko
How do I reference the rows in a particular column in a DataTable?
tblMyDataTable
row# colA colB pkID fkID
1 str1 srt2 23 19
2 str3 [null] 24 19
I understand I can get a _horizontal_ row of values with DataRowCollection.
For example, I could get the values in row2 like this:
DataRowCollection drc = tblMyTable.Rows[2];
and I could reference the values like this:
if (drc[1] == null);
{
[code here]
}
But how do I get a _vertical_ column of rows?
In the example above, if I used a foreach loop to loop through each row, I
would get the null value in colB - which I don't want.
Can I get a count of, and return, all non-null values in colB without
looping?
Thanks in advance.
tblMyDataTable
row# colA colB pkID fkID
1 str1 srt2 23 19
2 str3 [null] 24 19
I understand I can get a _horizontal_ row of values with DataRowCollection.
For example, I could get the values in row2 like this:
DataRowCollection drc = tblMyTable.Rows[2];
and I could reference the values like this:
if (drc[1] == null);
{
[code here]
}
But how do I get a _vertical_ column of rows?
In the example above, if I used a foreach loop to loop through each row, I
would get the null value in colB - which I don't want.
Can I get a count of, and return, all non-null values in colB without
looping?
Thanks in advance.