Solved

System.InvalidOperationException occured in system.dll

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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to force output to ascii 2 61
Header Font Size in Grid View 6 50
How do i create a simple array in a public class? 6 36
VB .net 2010 Byte array 2 21
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…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

734 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