Hi
Am I missing something when I'm trying to close a connection to SQL Server? My Code:
Try
DBConnectionString = String.Concat("server=", DBServer, ";database=", DBDatabase, ";Integrated Security=SSPI")
DBConnection = New SqlConnection
DBConnection.ConnectionString = DBConnectionString
DBConnection.Open()
Catch ex As Exception
....blah blah blah...
Finally
DBConnection.Close()
DBConnection.Dispose()
DBConnection = Nothing
End Try
For some reason, each connection is left as a sleeping process in the SQL Server activity log. Subsequently, after numerous calls to the DB, I have exceeded the number of connections allowed. Surely Close, Dispose and Nothing are killing it???
Cheers
Rob
Am I missing something when I'm trying to close a connection to SQL Server? My Code:
Try
DBConnectionString = String.Concat("server=", DBServer, ";database=", DBDatabase, ";Integrated Security=SSPI")
DBConnection = New SqlConnection
DBConnection.ConnectionString = DBConnectionString
DBConnection.Open()
Catch ex As Exception
....blah blah blah...
Finally
DBConnection.Close()
DBConnection.Dispose()
DBConnection = Nothing
End Try
For some reason, each connection is left as a sleeping process in the SQL Server activity log. Subsequently, after numerous calls to the DB, I have exceeded the number of connections allowed. Surely Close, Dispose and Nothing are killing it???
Cheers
Rob