Re: Try...Catch...Finally not firing finally?
- From: "Alvin Bruney [MVP]" <some guy without an email address>
- Date: Tue, 24 Apr 2007 22:20:27 -0400
The two conditions really aren't related - i don't think. Finally blocks
always fire, there's an implicit guarantee for that. True there was a bug in
1.1 that abrogated that guarantee, but it is fixed in 2.0. So the problem
would lie in the close code. It's quite possible that close is erroring out.
Put a trace from the db end to see if the close command is funneling thru to
the database engine.
--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
"David Lozzi" <dlozzi@xxxxxxxxxxxxx> wrote in message
news:C8ED204A-602C-47A9-BE76-467ED9083938@xxxxxxxxxxxxxxxx
Howdy,
I ran into a very interesting issue and I'm curios as to how this is
suppose to work. I am using Try...Catch...Finally statements for all
database connectivity in my ASP.NET 2.0 web application. I'm connecting to
IBM's Universe 10.2 using UniObjects.Net. Anyway, if the connection
errors, the Finally closes the connection. What I see happening is that
the function in the Finally statement either isn't running or doesn't
apply what its suppose to.
For example. Running Visual Studio 2005, I debug my web app and step
through a function that I am purposly erroring on. The session opens, then
a command errors out. In the Catch I am taking the ex.tostring and sending
it to a class function that I then email that to myself and then send the
user to a default error page using server.transfer("page",false). After
that function runs, the debugger sends me back to the calling function,
finishes the Catch then fires the Finally, which closes the session.
So my problem is that it appears that the database session is not closing
in the finally. I just moved the close session to the first line in the
Catch and it appears to close it properly...
Thanks!!
David Lozzi
.
- References:
- Try...Catch...Finally not firing finally?
- From: David Lozzi
- Try...Catch...Finally not firing finally?
- Prev by Date: FindControl with GridView
- Next by Date: Re: how to get the name of the current aspx file?
- Previous by thread: Re: Try...Catch...Finally not firing finally?
- Next by thread: TD tags are wider than necessary
- Index(es):
Relevant Pages
|