Transactions and Referential Integrity

  • Thread starter Thread starter Roger Rabbit
  • Start date Start date
R

Roger Rabbit

Hello,


I have a simple problem that involves an Order and OrderDetail
table.OrderDetail requires an Order Id to be present in Order i.e. ref
integrity prior to record insertion.

Using transactions to ensure that i dont end up with only order stubs and no
detail in case of an error I find that i get an error about a referential
integrity violation because of the above condition.

In other words because i dont call committrans until after i call
..executenonquery on the order detail insertion i get an error becuase the
..executenonquery method requires tha the value be present in Order....which
of course its not yet as i haven;t called .committrans.

It would seem this almost defeats the purpose of transactions?

Thanks

RR
 
I dunno if you've ever seen the cartoon that is my namesake but if you have,
then just imagine those big floppy ears being used to cover over those big
dopey eyes. Theres nothing wrong with Transactions, its my order of
operations that was the problem.

Teach me to try and watch Formula 1 replays and code at the same time.

RR
 
Back
Top