[vbnet] Using Statement et Try/Catch
Bonjour,
Petite question:
Avec l'utilisation du Using pour une connexion SQL et une Transaction, s'il arrive une exception, comment faire pour disposer l'objet??
Exemple:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Try
Using Connection = GetMyConnection()
Connection.Open()
Using Transaction = Connection.BeginTransaction
...ExecuteMyQuery...
Transaction.Commit()
End Using
End Using
Catch ex As Exception
(Connection et Transaction n'existe pas ici, comment les liberer??)
Throw ex
End Try |
Merci.