troubleshooting Question

Connection Pooling

Avatar of JamesAnthony
JamesAnthonyFlag for Ireland asked on
Visual Basic.NET
4 Comments1 Solution334 ViewsLast Modified:
Hi All
Have this code, works etc but I am trying to fill a table with sql attached, works for 541 records exactly every time then get error listed
I dont want to increase the max pool size as doing this will affect other servers that I have to connect to


this is statement in a loop, values change accordingly
 
Call executesql(insert into pricematrixWgtNew( DescNo, Sex, Conf, Fat, Code1, KgMin, KgMax, Penback,Unit) select 1,'A','O+','5-',886,0,239.9,0,'K'")

CODE

   Sub ExecuteSQL(ByVal SQLStateMent As String)


        gCancel = False
        Dim ExecuteConn As New SqlConnection(ConnStr)
        If ExecuteConn.State = 1 Then ExecuteConn.Close()
        ExecuteConn.Open()
        Dim SQLCommand1 As New SqlCommand
        Try
            SQLCommand1.CommandType = CommandType.Text
            SQLCommand1.CommandText = SQLStateMent
            SQLCommand1.Connection = ExecuteConn
            SQLCommand1.ExecuteNonQuery()
            If ExecuteConn.State = 1 Then ExecuteConn.Close() : ExecuteConn.Dispose()
        Catch exsql As SqlException
            'MyBox(exsql.Message)
            gCancel = True
            If ExecuteConn.State = 1 Then ExecuteConn.Close() : ExecuteConn.Dispose()
        End Try
    End Sub


ERROR

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.

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros