The ugly DeletedRowInaccessibleException error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a situation where I let users manipulate rows trough a datagridview,
when they save, I scroll trough the rows created by .GetChanges and report to
the database any changes through stored procedures. For updates and inserts,
there is no problems but for deletes I need a way to send to the stored
procedure the key value or values to delete the right row. But of course, if
I try to ask for the value of key column(s) I get the exception. Anybody
knows how to go around this?
 
Johnny said:
I have a situation where I let users manipulate rows trough a datagridview,
when they save, I scroll trough the rows created by .GetChanges and report
to
the database any changes through stored procedures. For updates and
inserts,
there is no problems but for deletes I need a way to send to the stored
procedure the key value or values to delete the right row. But of course,
if
I try to ask for the value of key column(s) I get the exception. Anybody
knows how to go around this?

I think you have to access the *original* version of the row, something
like:
row[column, DataRowVersion.Original]

Chris Jobson
 
I will try that but I also found an easy way out. Once I know the row is
deleted, I doa CancelChanges, then pick up data need.
Thanks for the suggestion

Chris Jobson said:
Johnny said:
I have a situation where I let users manipulate rows trough a datagridview,
when they save, I scroll trough the rows created by .GetChanges and report
to
the database any changes through stored procedures. For updates and
inserts,
there is no problems but for deletes I need a way to send to the stored
procedure the key value or values to delete the right row. But of course,
if
I try to ask for the value of key column(s) I get the exception. Anybody
knows how to go around this?

I think you have to access the *original* version of the row, something
like:
row[column, DataRowVersion.Original]

Chris Jobson
 
Back
Top