Thanks, that was the trick - adding the column to the row in the DataTable, not the dataview or the dataset :)
What I am trying to do is calculate someones age based on 3 database columns of the int type, their birth day, month, and year. Here is my current calculation:
// Fill Dataset
sqlCmd.Fill(ds, "Member");
// DataTable is created here
DataTable dt = ds.Tables[0];
// Add an "Age" column
dt.Columns.Add("HowOld");
// Calculate their age
for (int i=0; i<dt.Rows.Count; i++)
{
dt.Rows[i]["HowOld"] = DateTime.Now.Year - (int)dt.Rows[i]["bday_year"];
}
This doesn't take in account their birthday day being present in the current year though. Any idea how to accomindate that?
Thanks,
-- shawn
|