Open Database Connections Problem

L

Lars Netzel

Hey!

I have problems with timeout cause of problems obtaining a pool in the SQL
server.. and I guess It's because I might have forgotten to Close some
sqlConnection somewhere.. so I search thru my project and found 172 places
where I open a connection and I steped thru all the code in those place to
see if there was a Close command for each Connectionobject. In someplaces I
had to add a close command and then I recomplied and updated the Solution.

I still get the same problem.. from a spefiic situation where a few special
pages are involved. that makes me think it is a problem in the code and not
with the server or poolsize or anything. I have looked thru the code again
and there is for sure a Close command for each Open.

In Try statements I have put the Close command in the Finally statement
(that's the way to do it right?)

please help, what else have I missed?

/Lars Netzel
 
P

Patrice

Yes, the usual caveats is to forgot to close a connection when an exception
is raised. That said it looks like unlikely you have so much exceptions that
the problem appears immediatly.

In debug mode you could also register these connections to warn of unclaeand
connection at the end of the request.

As a side note I would stronly suggest to have a data access layer so that
you have only few open/close paris in your code...

Patrice
 
L

Lars Netzel

How can I register that in debug mode?

/Lars


Patrice said:
Yes, the usual caveats is to forgot to close a connection when an exception
is raised. That said it looks like unlikely you have so much exceptions that
the problem appears immediatly.

In debug mode you could also register these connections to warn of unclaeand
connection at the end of the request.

As a side note I would stronly suggest to have a data access layer so that
you have only few open/close paris in your code...

Patrice
 
L

Lars Netzel

Found the problem...

I found a Function that had a Return line (which then off course ends the
function) on the line before the Close command.. stupid!

/Lars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top