Another way (as an alternative to solution 1 by
RickZeeland[
^]) to update data is to use Linq.
Take a look at example:
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("ID", typeof(int)));
dt.Columns.Add(new DataColumn("In_out", typeof(string)));
for(int i=0; i<50; i++)
{
dt.Rows.Add(new Object[]{i, string.Format("row{0}",i)});
}
var query = dt.AsEnumerable()
.Where(r=>r.Field<int>("ID") % 2 ==0)
.ToList();
foreach (DataRow row in query)
{
row.SetField("In_out", "I");
}
Result:
ID In_out
0 I
1 row1
2 I
3 row3
4 I
5 row5
6 I
Change the code to your needs.