Click here to Skip to main content
15,879,239 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
See more:
I have the following data in the datatable.

Column1 Column2
1 Sir@America
2 Mam@London.
3 Child@Home.

I want to insert space instead of @ character in Column2.
So
How to find and replace a character in DataTable using c#?
Posted

1 solution

Try this.
for (int i = 0; i <= datatable.Rows.Count - 1; i++)
{
  datatable.Rows[i][1] = datatable.Rows[i][1].ToString().Replace ("@"," ");
}
 
Share this answer
 
Comments
Sandesh M Patil 2-Aug-11 7:43am    
good answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900