datacolumn replace

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
 
P

plmanikandan

Hi,

Thanks for your reply.Vb-Tops.com is very useful for me,but the links
are not working.


Regards,
Mani
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top