Solved

System.InvalidOperationException occured in system.dll

Posted on 2006-11-07
5
518 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
  • 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

803 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