"Deleted row information cannot be accessed through the row"

I’m sure I’ve accessed deleted row information before, not sure whether it was as a result of using DA via a .Fill(dataset,[table list],[tablerequestinfoV60) call.

My next step is to backtrack and just see if the problem presents outside of a DA environment, but I wanted to ask in the meantime whether there is any reason why I shouldn’t be able to access deleted record data via row.item[columnindex,DataRowVersion.Original] ?

See the screenshot below for the exception. No matter how I approach that row, I can’t see deleted records.

I can work around the problem, but would prefer to get to the bottom of it rather than bypassing the issue.

Paul.

Hello

Actually this is not related to Data Abstract. After the DataTable is loaded it is just a .NET object. Also I don’t see any exceptions on your screenshot, only an Object Inspector message that the .ItemArray property cannot be accessed (which is completely expected).

Could you show actual code that throws the exception and the exception itself?

Regards

Hello Anton,

Well, having worked around the issue and now having just reinstated the original code (a commented out method and not rekeyed different code), it is working as expected. The only thing I know has changed in the interim is that more int fields have been added to the end of the table (and my schema), which should not make a difference one way or another. For what it’s worth, my code is below, the exception would have been thrown on the setting of lMaxFormatId on the “true case”. The intention of the code being to take out the next ID in sequence for a non identity primary key field.

for each lRow:DataRow in FormatMasterTable.Rows do
begin
   case lRow.RowState = DataRowState.Deleted of
       true  : 	lMaxFormatId := Math.Max(lMaxFormatId,Int32(lRow.Item[colDataFormatMasterFormatId,DataRowVersion.Original]));
       false : 	begin
                   lList.Add(lRow.Item[colDataFormatMasterName].ToString);
		   lMaxFormatId := Math.Max(lMaxFormatId,Int32(lRow.Item[colDataFormatMasterFormatId]));
		end;
   end;
   // Or use RowState Default to give a version of the row no matter what state the row is i.e. added, deleted, unchanged etc. 
   // lMaxFormatId := Math.Max(lMaxFormatId,Int32(lRow.Item[colDataFormatMasterFormatId,DataRowVersion.Default]));
end;
lList.Sort(lComparer1);

Thanks for looking at this anyway.

Paul.