[{"data":1,"prerenderedAt":86},["ShallowReactive",2],{"/2025/09/12-deleted-data-row-and-linq":3},{"id":4,"title":5,"body":6,"date":77,"description":44,"extension":78,"meta":79,"navigation":80,"path":81,"robots":82,"seo":83,"stem":84,"__hash__":85},"posts/2025/09/12 deleted-data-row-and-LINQ.md","12 Deleted Data Row And LINQ",{"type":7,"value":8,"toc":74},"minimark",[9,18,25,28,31,45,47,50,58,60,63,71],[10,11,13],"post-title",{":date":12},"date",[14,15,17],"h1",{"id":16},"deleted-data-row-and-linq","Deleted Data Row and LINQ",[19,20,21],"notes",{},[22,23,24],"p",{},"This is a repost from my old blog. First posted in 9/27/2016.",[26,27],"br",{},[22,29,30],{},"Another interesting programming problem. I have the following code in VB.Net which throws error:",[32,33,34],"code-block",{},[35,36,41],"pre",{"className":37,"code":39,"language":40},[38],"language-text","dataRow.Delete() 'One of the rows in dataSet\n\ndataSet.Tables(\"TableName\").Rows.Cast(Of DataRow).FirstOrDefault(Function(dr) dr(\"ColumnName\") = certainCondition)\n","text",[42,43,39],"code",{"__ignoreMap":44},"",[26,46],{},[22,48,49],{},"The error says \"Deleted row information cannot be accessed through the row\". Pretty clear message, so I did the following:",[32,51,52],{},[35,53,56],{"className":54,"code":55,"language":40},[38],"dataSet.Tables(\"TableName\").Rows.Cast(Of DataRow).FirstOrDefault(Function(dr) dr(\"ColumnName\") = certainCondition AndAlso dr.RowState \u003C> DataRowState.Deleted)\n",[42,57,55],{"__ignoreMap":44},[26,59],{},[22,61,62],{},"But the code above throws the same error. Apparently the deleted check has to be the first condition which again makes sense. Thus, the following code runs perfectly fine:",[32,64,65],{},[35,66,69],{"className":67,"code":68,"language":40},[38],"dataSet.Tables(\"TableName\").Rows.Cast(Of DataRow).FirstOrDefault(Function(dr) dr.RowState \u003C> DataRowState.Deleted AndAlso dr(\"ColumnName\") = certainCondition)\n",[42,70,68],{"__ignoreMap":44},[22,72,73],{},"There you go.",{"title":44,"searchDepth":75,"depth":75,"links":76},2,[],"2025-09-12T00:00:00.000Z","md",{},true,"/2025/09/12-deleted-data-row-and-linq",null,{"title":5,"description":44},"2025/09/12 deleted-data-row-and-LINQ","0XpgB2HByIIjAsqQZ8avps8-4-Wg2pPdYY565wWYzTQ",1785167453195]