T
telysium.org
submit articles
www.telysium.org
www.telysium.org
telysium.org said:Catch the MySqlException at the page error handler or the application error
handler and dispose relevant objects.
telysium.org said:look...
Disposing an object will dispose the objects it contains including
connection objects. ASP.NET garbage collects the page which contains the
GetData object which contains the connection object if an exception occurs
and you dispose the page. Disposing a connection implicitly closes it. You
do not need your below code. The points you make are applicable to a
Windows form application and should always be implemented there but are
irrelevant to what "we" have been talking about.
You seem to have realized in your last statement that this is indeed the
case. Is your method the best way? From my view no because what the page
is trying to do still failed in your hypothetical due to outside variables,
so you need to alert the user to the network failure and the page execution
has failed. Therefore, the connection would be disposed anyway. Why
dispose what will be disposed?. If the ASP.NET application fails due to
network failures to a backing store the best solution is to seek either a
better connection or better performing server host.
However, I should have implemented the code you suggest below to cover all
cases in which the class could be used since it was released for all...
telysium.org said:That's why you dispose the page. You cannot do this in a Windows
form since you cannot dispose the application that's running. With
the page object you can. Hello are you listening? DISPOSING A
CONNECTION OBJECT IMPLICITLY CLOSES IT IMMEDIATELY dumb ass. It will
be immediately closed and returned to the pool.
What you say about
remaining in use and in the pool and pool exceptions is bullshit.
telysium.org said:I see you're are obsessed with me and my site. You're creepy...LOL
Sami Vaaraniemi said:No I'm not obsessed with you or your site. It's just that I've had to fix
enough sloppy code written by others that may leak database connections and
result in a fragile website that goes on its knees under load or bad
conditions. The ADO.NET article on your site now shows robust and solid code
that under no circumstances will leak database connections. I know there's a
lot of sloppy sample code around there but maybe the solid code on your site
makes a difference and I'll have less code to fix in the future.
Sami
www.capehill.net