I have a DataTable with a Column of numbers called x value
I want to return the sum value that column.
The column will always have a number in it (so no need to worry about blank / null values).
My code:
int x = 0;
foreach (DataRow dr in SqlCon.ds.Tables[3].Rows)
{
foreach (DataColumn dc in SqlCon.ds.Tables[3].Columns)
{
if (dc.ColumnName == "x value")
{
//calc value
}
}
}
Many Thanks,
ps. have looked on SO already but cannot find the duplicate (I assume it is about but it's Monday morning and my google skill aren't the best!)