Angel
I did the simple changes you suggested with no effect.
I believe it must be the IDE leaking, since I did not have
the same problem under VS 2002.
What I'll try to do is reproduce it with some queries
against pubs, then I can attempt to report it as a bug
Glad you like the design, it means that I can do cross-
database development very easily.
Paul
-----Original Message-----
Paul,
The code looks really good, a very nice way to use ado.net imho.
Minor comments would be to remove the
If connection.State = ConnectionState.Open
this is not necesary since closing a closed connection is not a
problem.
You may want to switch the dispose order
connection.Dispose()
command.Dispose()
To
command.Dispose()
connection.Dispose()
The exception you are getting would seem to indicate that
connections are not being disposed, this does not look possible
given your code. My only concern is that for some reason you are
throwing an exception inside of the Finally clause and close and
dispose are not getting called. The other posibility would be that
debug mode of Visual Studio is leaking
--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers
no rights. Please do not send email directly to this alias. This
alias
is for newsgroup purposes only.
message Angel
The provide is SqlClient and the code is as below...
Public Function ExecuteNonQuery(ByVal connection
As IDbConnection, ByVal command As IDbCommand) As Integer
Try
' Open the connection
connection.Open()
' Try to run the command
Trace.WriteLineIf
(DataSwitch.TraceVerbose, "Executing " +
command.CommandText, "SQL")
Return command.ExecuteNonQuery()
Catch ex As Exception
' Just rethrow for now, but gives us a
breakpoint
Throw
Finally
' Tidy up
If connection.State = ConnectionState.Open
Then
connection.Close()
End If
connection.Dispose()
command.Dispose()
End Try
End Function
Full error message as follows...
An unhandled exception of
type 'System.InvalidOperationException' occurred in
cs.datalayer2003.dll
Additional information: Timeout 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.
The code, which is from my library, is running fine in a
number of large applications.
Paul
-----Original Message-----
What provider are you using, do you have some code?
Thanks
--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers
no rights. Please do not send email directly to this alias. This
alias is for newsgroup purposes only.
message I have one application at the moment that's behaving
oddly. When I run it in debug mode after a few SQL
statements have been issued, I get an "Illegal operation
exception in System.Data" with a further note that it's
likely to be the connection pool being full.
A few points...
1. If I run this in Release mode, the problem goes away.
2. If I profile the connection pool, it never goes above 7
and I believe the default pool size to be 100.
3. I'm very carefully disposing of all connection objects
to ensure that they return to the connection pool.
This is in .NET 1.1 Framework - I didn't have this problem
with the same application under 1.0 so I'm think it's a
bug of some sort.
TIA
Paul
.
.