"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com>
schrieb:
There have been several discussions about using .dispose whenever you
finish with an object that has a dispose. Any reason not to use it here?
I suggest to use 'Dispose' instead of 'Close' if you want to dispose the
connection. Calling 'Dispose' on the connection will implicitly call
'Close' if the connection is not yet closed:
\\\
Dim Connection As SqlConnection
Try
Connection = New SqlConnection()
Connection.Open()
' Use the connection here.
Catch
' Place error handling code here.
Finally
If Not Connection Is Nothing Then
Connection.Dispose()
End If
End Try
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>