What you need is to create a transaction. A transaction is a list of db commands that will only true happen when the transaction is commited. Example, your Update command will happen but the results will be cached, it will not be stored your db until the transaction is commited. So you will only commit this transaction after your insert. I cant provide codes because of the framework we use here but try looking for ".Net Transactions" on google.