P
plmanikandan
Hi,
I have a datatable with two datacolumns as below
Name(text) status(int)
wws 0
ddd 1
ggg 0
hhh 0
cfff 1
Status datacolumn will have values either 0 or 1 only.
I need to change the value 0 as "Pass" and 1 as "Fail".
for changing the values i loop through each row and replace 0 as
"Pass" and 1 as "Fail".
for(int i=0;i<dataTable.rows.count;i++)
{
if(dataTable.Rows[1].ToString()==int.Parse("0"))
{
dataTable.Rows[1]="Pass";
}
if(dataTable.Rows[1].ToString()==int.Parse("1"))
{
dataTable.Rows[1]="Fail";
}
}
I think above method takes more time,because it loops through each row
and replace the value.
Is there any way to replace all the values in the datacolumn
simultaneously with out looping
Regards,
Mani
I have a datatable with two datacolumns as below
Name(text) status(int)
wws 0
ddd 1
ggg 0
hhh 0
cfff 1
Status datacolumn will have values either 0 or 1 only.
I need to change the value 0 as "Pass" and 1 as "Fail".
for changing the values i loop through each row and replace 0 as
"Pass" and 1 as "Fail".
for(int i=0;i<dataTable.rows.count;i++)
{
if(dataTable.Rows[1].ToString()==int.Parse("0"))
{
dataTable.Rows[1]="Pass";
}
if(dataTable.Rows[1].ToString()==int.Parse("1"))
{
dataTable.Rows[1]="Fail";
}
}
I think above method takes more time,because it loops through each row
and replace the value.
Is there any way to replace all the values in the datacolumn
simultaneously with out looping
Regards,
Mani