Im using SQL Profiler to monitor connection created by my Web Application. I noticed that calling the Close method didnt close immediately the connection, it takes 1 to 5 minutes before the connection will be closed in the SQL Profiler.
I think SQL Profiler is checking connection in real time, Is there a way to make the connection close immediately? Even using this simple code below will make the SQLConnection behave the same.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TestConn()
End Sub
Sub TestConn()
Dim cn As New SqlClient.SqlConnection
cn.ConnectionString = Utility.ConfigReader.ConnectionString
cn.Open()
System.Threading.Thread.Sleep(5000)
cn.Close()
cn.Dispose()
End Sub
Thanks!
I think SQL Profiler is checking connection in real time, Is there a way to make the connection close immediately? Even using this simple code below will make the SQLConnection behave the same.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TestConn()
End Sub
Sub TestConn()
Dim cn As New SqlClient.SqlConnection
cn.ConnectionString = Utility.ConfigReader.ConnectionString
cn.Open()
System.Threading.Thread.Sleep(5000)
cn.Close()
cn.Dispose()
End Sub
Thanks!