DataTable aa = new DataTable();
aa.Columns.Add("aa");
aa.Columns.Add("bb");
aa.Rows.Add();
DataRow bb = aa.NewRow();
bb["aa"] = "aa";
bb["bb"] = "bb";
aa.Rows.Add(bb);/*添加新行*/
aa.Rows[0].ItemArray = bb.ItemArray;/*修改原有行*/
aa.Columns.Add("cc");
aa.Columns.Add("dd");
DataRow cc = aa.NewRow();
cc.ItemArray = aa.Rows[0].ItemArray;
cc["cc"] = "cc";
cc["dd"] = "dd";
aa.Rows.Add(cc);/*添加新行*/
aa.Rows[0].ItemArray = cc.ItemArray;/*修改原有行*/
向存在数据的datatable中插入datarow
最新推荐文章于 2023-05-12 09:21:30 发布