Hi,
I am getting an error message about max con pool size is reached
As you can see the error is in a class module which I am calling from a form to do an update.
In the form I loop through this datareader and after the loop I use oDr.close
oDr=nothing
-------------------------------------------
Public Function UpdateDurations(ByVal strIdentifier As String, ByVal dblDuration As Double) As SqlDataReader
Dim strSQL As String = "CSA_SP_UpdateDurations"
Dim oCon As SqlConnection
Dim oCmd As SqlCommand
Try
oCon = New SqlConnection(ConnectToDB)
oCmd = New SqlCommand(strSQL, oCon)
With oCmd
.CommandType = CommandType.StoredProcedure
.Parameters.Add("@Identifier", SqlDbType.VarChar, 50)
.Parameters("@Identifier").Value = strIdentifier
.Parameters.Add("@Duration", SqlDbType.Float, 8)
.Parameters("@Duration").Value = dblDuration
oCon.Open()
Return .ExecuteReader(CommandBehavior.CloseConnection)
End With
Catch ex As Exception
Throw ex
End Try
End Function
-------------------------------------------
Do you know why I am getting this error in the class module?
THanks
I am getting an error message about max con pool size is reached
As you can see the error is in a class module which I am calling from a form to do an update.
In the form I loop through this datareader and after the loop I use oDr.close
oDr=nothing
-------------------------------------------
Public Function UpdateDurations(ByVal strIdentifier As String, ByVal dblDuration As Double) As SqlDataReader
Dim strSQL As String = "CSA_SP_UpdateDurations"
Dim oCon As SqlConnection
Dim oCmd As SqlCommand
Try
oCon = New SqlConnection(ConnectToDB)
oCmd = New SqlCommand(strSQL, oCon)
With oCmd
.CommandType = CommandType.StoredProcedure
.Parameters.Add("@Identifier", SqlDbType.VarChar, 50)
.Parameters("@Identifier").Value = strIdentifier
.Parameters.Add("@Duration", SqlDbType.Float, 8)
.Parameters("@Duration").Value = dblDuration
oCon.Open()
Return .ExecuteReader(CommandBehavior.CloseConnection)
End With
Catch ex As Exception
Throw ex
End Try
End Function
-------------------------------------------
Do you know why I am getting this error in the class module?
THanks