Paul On Technology

Exploring technology

March 2005 - Posts

Transactions and the using statement

I was wondering if someone could clarify this for me. If I have the following code (simplified for brevity) :

using (OracleConnection conn = new OracleConnection() )

{

    using (OracleTransaction trans = conn.BeginTransaction() )

    {

           // Some working code...

 

           trans.Commit();

    }

}


If an exception occurs and commit is never called are all changes absolutely discarded when the transaction is disposed or is the database left in some wierd state?

Thanks in advance!

 

More Posts