How to Edit a row in the datatable

前端 未结 6 1062
说谎
说谎 2020-12-05 18:46

I have created a data table. It has 3 column Product_id, Product_name and Product_price

    Datatable tabl         


        
6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-05 18:51

    If your data set is too large first select required rows by Select(). it will stop further looping.

    DataRow[] selected = table.Select("Product_id = 2")
    

    Then loop through subset and update

        foreach (DataRow row in selected)
        {
            row["Product_price"] = "";
        }
    

提交回复
热议问题