Is using a DataSet's column Expression works in background same as manual calculation?
Posted
by Harikrishna
on Stack Overflow
See other posts from Stack Overflow
or by Harikrishna
Published on 2010-05-18T10:12:13Z
Indexed on
2010/05/18
11:51 UTC
Read the original article
Hit count: 134
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.
© Stack Overflow or respective owner