I would like to see Microsoft confirm or explain how to avoid these
issues. I can easily work around using the ConnectionString property
but the leak on IsEmpty(cn) would be harder to work around due to the
use of it in lots of places.
<%
Sub CloseFunction( cn )
If Not IsEmpty(cn) Then ' leak #1 comes from calling IsEmpty on a
connection object
cn.Close
End If
End Sub
Sub ConnectionTest
On Error Resume Next
for i = 1 to 20000
Set theConnection = Server.CreateObject("ADODB.Connection")
theConnection.CommandTimeout = 120
theConnection.Provider = "sqloledb"
ProvStr =
"Server=YourServer;Trusted_Connection=no;UID=YourPassword;PWD=police&0!;Database=YourDatabase"
theConnection.Open ProvStr
test = theConnection.ConnectionString 'leak #2 comes from accessing
ConnectionString
CloseFunction theConnection
set theConnection = Nothing
next
Response.Write i
Response.Write err.Description
End Sub
ConnectionTest
%>
I cannot reproduce your issues since I am still using IIS6
FWIW, I never used IsEmpty to test whether a variable referred to a
Connection object. I typically use "Is Nothing" to test whether or not a
variable refers to an object or not.
--
HTH,
Bob Barrows