Archive for abril, 2012
Visual Basic .NET – Transacción con SqlConnection
Written by lopezatienza on 12/04/2012 – 14:33 -Dim conexion As SqlConnection = Nothing Dim transaccion As SqlTransaction = Nothing Try conexion = New SqlConnection("ConnectionString") conexion.Open() transaccion = conexion.BeginTransaction() 'Lógica de negocio transaccion.Commit() transaccion = Nothing conexion.Close() conexion = Nothing Catch ex As Exception If (Not IsNothing(transaccion)) Then transaccion.Rollback() transaccion = Nothing End If If (Not IsNothing(conexion)) Then conexion.Close() conexion = Nothing End If End Try
Posted in Visual Basic .NET | No Comments »