Output SqlParameter + SqlTransaction

  • Thread starter Thread starter Nik
  • Start date Start date
N

Nik

Hello,

I use an output parameter to update identity column in my table after
inserting new row and it works fine - identity value is read from the
database and written to approprate field in DataRow. However, if I do
the inserting inside a transaction and call the Rollback method after
that, the identity value is no longer valid and it should be reverted
to old value. Do I have to do this manually or is there a way to
automate this?

I work with Framework v1.1.

Thanks.

Nik
 
Nik,

DataRow does not participate in a transaction and it will not be automatic.
What you could do is to call RejectChanges method for the DataRow and all
the data inside of the DataRow will be rolledback
 
AFAIK, if I call RejectChanges on a DataRow whose state is Added (which
is the case here), it will be removed from the table. However, you told
me what I need to know - I have to revert the identity values manually
(or change my programming logic so it does not matter).

Thanks for reply.

Nik
 
Back
Top