Timeout / Obtaining a connection from the pool - Please Help!

M

Martin

Dear Group

I'm desperate for a solution to this problem.
Let's assume I've the following code:

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click

Dim sqlConnection As New System.Data.SqlClient.SqlConnection

sqlConnection.ConnectionString = "workstation id=THEINTREPIDFOX;packet
size=4096;user id=sa;data source=""(local)"";p" & _
"ersist security info=False;initial catalog=TestDB"

sqlConnection.Open()
sqlConnection.Close()
sqlConnection = Nothing

End Sub

When I click 100 times on the button the page finally times out with:

Timeout expired. The timeout period elapsed prior to obtaining a
connection from the pool. This may have occurred because all pooled
connections were in use and max pool size was reached.

Of course I could increase the max pool size but this isn't the
solution to this problem. I wonder what's wrong with my code?
According to MSDN, if the connection is closed it's released back into
the pool. Also tried to dispose but nothing helps. It looks like that
it keeps connections and doesn't release them. I'm grateful for any
hints, ideas, suggestions on this problem as I'm very desperate to
solve this.

Thanks very much for your time & efforts!

Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top