Data Table + delete a row in c# using loop

前端 未结 3 1682
故里飘歌
故里飘歌 2021-01-04 08:26

I have a data table and I want to delete a row here is my code it\'s throwing me an exception

foreach (DataRow row in dt1.Rows)
{
    if ((row[\"Name\"] == \         


        
3条回答
  •  旧巷少年郎
    2021-01-04 08:31

    Instead of using dt1.Rows, use dt1.Select()

    The goal here is not to use the collection itself, but rather an array of row that is not the Rows collection

提交回复
热议问题