Is using a DataSet's column Expression works in background same as manual calculation?
- by Harikrishna
I have one datatable which is not bindided and records are coming from the file by parsing it in the datatable dynamically every time. Now there is three columns in the datatable Marks1,Marks2 and FinalMarks. And their types is decimal. Now for making addition of columns Marks1 and Marks2 's records and store it into FinalMarks column,For that what I do is :
datatableResult.Columns["FinalMarks"].Expression="Marks1+Marks2";
It's works properly.
It can be done in other way also is
foreach (DataRow r in datatableResult.Rows)
{
r["FinalMarks"]=Convert.ToDecimal(r["Marks1"])+Convert.ToDecimal(r["Marks2"]);
}
Is first approach same as second approach in background means is both approach same or what?
EDIT: I want to know that first approach works in background as second approach.