SQL Transaction Statement
Posted on 2008-06-25
Im trying to get my headaround the sqltransaction class.
I can do the simple statement like (see below).
//Execute Stage 1
using (trans = con.BeginTransaction())
string strInsertData = " INSERT INTO BLAH BLAH BLAH WHERE BLAH =@BLAH";
SqlCommand cmd_ExecuteInsert = new SqlCommand();
// MORE CODE
cmd_ExecuteInsert_RMA.Transaction = trans;
//Execute Stage 2
// OK now I want to Update another database, but if it fails I need to Roll back stage 1
// Can someone provide an example on how to do this please