Solved

System.InvalidOperationException occured in system.dll

Posted on 2006-11-07
5
522 Views
Last Modified: 2012-06-27
Hi Foks,

My vb.net application requires sql connection to exceute some tasks. I am experiencing the below error message intermittently.. and here is my connection code.

Imports System.Data.SqlClient
Public Class SqlHelper

    Public Function GetConnection() As SqlConnection
        Dim cn As New SqlConnection
        With cn
            .ConnectionString = "Data Source = .;Initial Catalog=xxxxxxx;Integrated security=SSPI"
            .Open()
        End With

        Return cn
    End Function

End Class

The detailed exception message is

System.InvalidOperationException occured in System.data.dll

Additional Information: Time out 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.

How should i get rid of this situation ????

0
Comment
Question by:niger007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 8

Assisted Solution

by:sabeesh
sabeesh earned 125 total points
ID: 17896048
check your connection object , once you have done the database operation CLOSE the connection object. this error is because  application’s connection pool reaches its limits. so it is waiting for a connection to close. check your code everywhere ensure that you are closing all connection objects

refer :http://www.dbazine.com/sql/sql-articles/charran2
0
 
LVL 35

Accepted Solution

by:
YZlat earned 125 total points
ID: 17897654
try

 cn.ConnectionTimeout = 0
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17897656
Imports System.Data.SqlClient
Public Class SqlHelper

    Public Function GetConnection() As SqlConnection
        Dim cn As New SqlConnection
        With cn
            .ConnectionString = "Data Source = .;Initial Catalog=xxxxxxx;Integrated security=SSPI"
            .ConnectionTimeout = 0
            .Open()
        End With

        Return cn
    End Function

End Class
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question