Error : Timeout expired. ...... max pool size was reached

Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Dec 2006
Posts: 8
Reputation: artee is an unknown quantity at this point 
Solved Threads: 0
artee artee is offline Offline
Newbie Poster

Error : Timeout expired. ...... max pool size was reached

 
0
  #1
Jan 5th, 2007
I get the following 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."

The below code is in the click event of the Upload button. This works fine when it is executed the first time (for loop, loops thru around 100 records). However, when I click the button the second time, it displays the above error after looping around 6 to 8 times.

As far as I know, I am closing the connection.
What am I doing wrong?
Please help
- Artee

  1. Private Sub btnUpload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpload.Click
  2. Dim con As New ConnectClass
  3. Dim myConnect As String
  4. Dim cmdString As String
  5. Dim i As Integer, j As Integer
  6. Dim ds1 As New DataSet
  7. Dim dv2 As New DataView
  8. ds1.Merge(mCSV.CSVDataSet.Tables(0).Copy)
  9. ds1.Clear()
  10.  
  11.  
  12. dv2 = New DataView(ds1.Tables(0))
  13. For i = 0 To mCSV.CSVDataSet.Tables(0).DefaultView.Count - 1
  14.  
  15.  
  16. cmdString = " Select * from SCHDB.dbo.DistrictAll " & _
  17. " where DCode = '" & dgrdView1.Item(i, 0) & "'"
  18.  
  19. Dim da As New SqlDataAdapter(cmdString, con.GetDBConnection)
  20. If da.SelectCommand.ExecuteReader.HasRows = False Then
  21. Else
  22.  
  23. Dim drv As DataRowView = dv2.AddNew
  24. For j = 0 To 13
  25. drv(ColNameCheck(j)) = dgrdView1.Item(i, j)
  26. Next
  27. End If
  28.  
  29. da.Dispose()
  30. con.GetDBConnection.Dispose()
  31.  
  32. Next
  33. dgrdUploadedAll.DataSource = dv2
  34. con.GetDBConnection.Close()
  35. End Sub
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC