Recommended Transaction Use
§Standard db access with Transactions
§Public Function MyFunc()
§ ‘Get the database current in AutoCAD
§ Dim db As Database = HostApplicationServices.WorkingDatabase()
§
§ ‘Start a transaction using the database transaction manager
§ Using trans As Transaction = db.TransactionManager.StartTransaction()
§ ‘Do all database operations here
§ ‘Lets get the block table from the database
§ ‘Drill into the database and obtain a reference to the BlockTable
§ Dim bt As BlockTable = trans.GetObject(db.BlockTableId, OpenMode.ForWrite)
§ ‘Everything successful, so commit the transaction
§ trans.commit()
§ End Using
§End Function
In this more complete example we can see that we are relying on the Using keyword to dispose of the transaction.  Notice that if everything was successful the commit method of the transaction is called.  In your code you will want to also use a Try Catch block so you can gracefully handle any error that may occur. In the Catch block you can tell the user there was an error and take appropriate action. You would not need to dispose of the Transaction explicitly however because the Using keyword will take care of that for us.