Re: DataTable.GetChanges(DataRowState.Deleted), how to access data?

  • Thread starter Thread starter Jon Skeet [C# MVP]
  • Start date Start date
J

Jon Skeet [C# MVP]

Eric Peterson said:
I need to see the row data when I delete rows, however the table that
GetChanges returns doesn't allow me to view the actual row data. Is
it supposed to? What is the point of returning a table with deleted
rows if you cannot access the data from those rows? (my datatable is
disconnected, created, and filled manually).

How are you trying to view the row data? You'll probably need to ask
for RowVersion.Original.
 
I am basically doing this

tmpdatatable = datatable.GetChanges(DataRowState.Deleted)

for each row in tmpdatatable
string = row(0)
next

i get a DeletedRowDataInaccesssible exception when i try to get the string.




----- Jon Skeet [C# MVP] wrote: -----

Eric Peterson said:
I need to see the row data when I delete rows, however the table that
GetChanges returns doesn't allow me to view the actual row data. Is
it supposed to? What is the point of returning a table with deleted
rows if you cannot access the data from those rows? (my datatable is
disconnected, created, and filled manually).

How are you trying to view the row data? You'll probably need to ask
for RowVersion.Original.
 
Eric Peterson said:
I am basically doing this

tmpdatatable = datatable.GetChanges(DataRowState.Deleted)

for each row in tmpdatatable
string = row(0)
next

i get a DeletedRowDataInaccesssible exception when i try to get the string.

So instead of row(0), use row(0,DataRowVersion.Original) - that *may*
give you what you want. I haven't tried it though.
 
that works, thanks

----- Jon Skeet [C# MVP] wrote: ----

Eric Peterson said:
I am basically doing thi
string = row(0
nex

So instead of row(0), use row(0,DataRowVersion.Original) - that *may*
give you what you want. I haven't tried it though
 
Back
Top