Operation is not allowed when the object is closed
I am facing an error on the web page that I am working on. The problem is when I try to open up the web page: www.ice-tech.com It loads fine, but when you try to refresh it, it c开发者_StackOverflowrashes.
You can see the error itself on-line. Can someone help me?
I see the following code failing:
Line 36: If ConnectCount = 0 Then
Line 37: ' Close the Connection
Line 38: Conn.Close()
Line 39: Conn = Nothing
Line 40: End If
Looks like you are closing a connection that has already been closed. Check the Conncetion.State before closing it (again).
For more information see ConnectionState Enumeration.
Possible solution:
If ConnectCount = 0 And Conn.State == ConnectionState.Open Then
' Close the Connection
Conn.Close()
Conn = Nothing
End If
精彩评论