sql POOL Error.

  • Thread starter Thread starter Lal
  • Start date Start date
L

Lal

Hello,

I am using VB.net & sql2000 for developing some s/w. I am open the
connection and close that after using. but after continuous using the
following error is coming

how can I avoid this error please help me..

I am sending the code also

Publicc Sub FillCombo(ByVal SQLCombo As String, ByVal CBox As
Windows.Forms.ComboBox, ByVal ConString As String)
Dim CON As New SqlClient.SqlConnection()
CON.ConnectionString = ConString
CON.Open()

Dim COM As SqlClient.SqlCommand
COM = New SqlClient.SqlCommand()
COM.Connection = CON
COM.CommandType = CommandType.Text
COM.CommandText = SQLCombo
Dim DR As SqlClient.SqlDataReader
DR = COM.ExecuteReader()
CBox.Items.Clear()
CBox.Items.Add("")
CBox.DropDownStyle = Windows.Forms.ComboBoxStyle.DropDownList
While (DR.Read())
CBox.Items.Add(DR(0))
End While
CBox.SelectedIndex = 0
DR.Close()
CON.Close()
End Sub

This is how we are calling the functions.

SQL = "SELECT Country FROM CountryMaster ORDER BY Country"
Dim DB As New Scriptings.Databases()
DB.FillCombo(SQL, cboCountry, ConnectionString & 1)
DB = Nothing


ERROR IS

An unhandled exception of type 'System.InvalidOperationException' occurred
in system.data.dll

Additional information: 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.



Regards

Lal
 
Lal,

In the case of the Connection is adviced to use the "dispose" instead of
"close" in version 2002/2003. It seems that there is some overloading for
the connectionpooling inside that.

I hope this helps?

Cor
 
Back
Top