How to Edit a row in the datatable

前端 未结 6 1043
说谎
说谎 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:52

    You can traverse through the DataTable like below and set the value

    foreach(DataTable thisTable in dataSet.Tables)
    {
        foreach(DataRow row in thisTable.Rows)
        {
            row["Product_name"] = "cde";
        }
    }
    

    OR

    thisTable.Rows[1]["Product_name"] = "cde";
    

    Hope this helps

提交回复
热议问题