943,846 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 11759
  • VB.NET RSS
Jan 5th, 2007
0

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

Expand Post »
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

vb.net Syntax (Toggle Plain Text)
  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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
artee is offline Offline
8 posts
since Dec 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: New in VB.net
Next Thread in VB.NET Forum Timeline: VB.NET Projects





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC