c# - How to Edit a row in the datatable - Stack Overflow

PHOTO EMBED

Tue Jan 25 2022 20:43:40 GMT+0000 (Coordinated Universal Time)

Saved by @javicinhio

foreach(DataRow dr in table.Rows) // search whole table
{
    if(dr["Product_id"] == 2) // if id==2
    {
        dr["Product_name"] = "cde"; //change the name
        //break; break or not depending on you
    }
}
content_copyCOPY

https://stackoverflow.com/questions/19629644/how-to-edit-a-row-in-the-datatable