Hi,

I have the following code that gets run in my database wrapper class.

If Not (m_conn Is Nothing) Then
If m_conn.state = ConnectionState.Open Then
m_conn.Close()
End IF

m_conn = Nothing
End If

I get the following error on the m_conn.Close() line:

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

Additional information: A connection pooling error has occurred.

The IF has already checked that the connection is open so why the hell is it
saying the operation is invalid?

It typically seems to produce this error after doing a couple of debug runs
of the app.

Regards,
Peter

Re: connection pooling problems with sqlconnection object by William

William
Mon Oct 27 10:37:16 CST 2003

First, trap the exception to see what's going on (in detail) and show us.

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Peter Row" <peter.row@oxfordcc.co.uk> wrote in message
news:uGnIYuInDHA.2160@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> I have the following code that gets run in my database wrapper class.
>
> If Not (m_conn Is Nothing) Then
> If m_conn.state = ConnectionState.Open Then
> m_conn.Close()
> End IF
>
> m_conn = Nothing
> End If
>
> I get the following error on the m_conn.Close() line:
>
> An unhandled exception of type 'System.InvalidOperationException' occurred
> in system.data.dll
>
> Additional information: A connection pooling error has occurred.
>
> The IF has already checked that the connection is open so why the hell is
it
> saying the operation is invalid?
>
> It typically seems to produce this error after doing a couple of debug
runs
> of the app.
>
> Regards,
> Peter
>
>