相关疑难解决方法(0)

如何编辑数据表中的行

我创建了一个数据表.它有3列Product_id,Product_name和Product_price

    Datatable table= new DataTable("Product");

    table.Columns.Add("Product_id", typeof(int));
    table.Columns.Add("Product_name", typeof(string));
    table.Columns.Add("Product_price", typeof(string));

    table.Rows.Add(1, "abc", "100");
    table.Rows.Add(2, "xyz", "200");
Run Code Online (Sandbox Code Playgroud)

现在我想通过索引找到并更新该行.

比如说

我想将Product_name列的值更改为具有Product_id列值的"cde" :2.

c# datatable

19
推荐指数
4
解决办法
17万
查看次数

标签 统计

c# ×1

datatable ×1