title: how to do error handling with using statements in C#
body: <p>im trying to do delete records from multiple database tables. For error handling i'm using a try/catch block as seen beneath. </p>
  
  <pre><code>try
  {
      using (SqlCeConnection oConn = new SqlCeConnection(ConnectionString))
      {
          oConn.Open();
          using (SqlCeTransaction transaction = oConn.BeginTransaction())
          {
              //delete from multiple tables using ADO.NET
              transaction.Commit();
          }
      }
  }
  catch
  {
     //error handling
  }
  </code></pre>
  
  <p>problem is when an exception is raised the transaction is not rolled back. When reading multiple forums my conclusion is that 'using' statements should dispose the transaction and the connection. When disposed, the uncommitted transaction should be rolled back. </p>
  
  <p>Can someone tell me what I'm doing wrong.</p>