Wrox Home  
Search P2P Archive for: Go

  Return to Index  

activex_data_objects thread: RollbackTrans does not revise OriginalValue?


Message #1 by "Eric Huckabay" <EricHuck@a...> on Thu, 2 Jan 2003 17:12:47
I have an odd scenario, and I suspect that I must be missing something 
obvious, but am having no luck with web and archive searches.

Our business logic works as follows (pseudocode, error checking excluded):

FUNCTION BusinessObject.Save()
  Connection.BeginTrans()
  IF THIS.Verify()
    AdoRecordSet.UpdateBatch()
  ENDIF
  FOR EACH ChildBizObject
    ChildBizObject.Save()
  ENDFOR
  IF THIS.AnythingFailed
    Connection.RollbackTrans()
  ELSE
    Connection.CommitTrans()
  ENDIF
ENDFUNC

The problem is that for a new record (appended locally, edited in UI), 
the value of AdoRecordSet.Fields('x').OriginalValue changes during 
UpdateBatch(), but does not revert during RollbackTrans().  If the user 
then corrects whatever caused the error and retries, I get a concurrency 
error stating that the record has been deleted.  (I suspect that the 
AdoRecordSet is trying to issue an Update instead of re-issuing an 
Insert.)

Does anyone have any suggestion for resolving the situation?  My first 
thoughts were to manually null the original values or somehow force an 
insert, or perhaps find a way to make the OriginalValue fields revert 
during the rollback, but I have not found any way to do so thus far.

Help is much appreciated.

 . . . . . . . -- Eric

  Return to Index