|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SqlDataAdapter: Connection closed on exception?Hi,
An SqlDataAdapter always opens its Conection and closes it automaticly. But does it Close the connection also when an exception occured? I tried to test it, and the connection was everytime closes, but I don't knwo if this would happen with every type of exception... I googled around for it but didn't find anything. Anybody could clear this out, Thanks, Pieter Yes, it does.
-- Show quoteMiha Markic [MVP C#] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ "Pieter" <pietercou***@hotmail.com> wrote in message news:%23zVRFgT4FHA.3312@TK2MSFTNGP09.phx.gbl... > Hi, > > An SqlDataAdapter always opens its Conection and closes it automaticly. > But does it Close the connection also when an exception occured? > > I tried to test it, and the connection was everytime closes, but I don't > knwo if this would happen with every type of exception... I googled around > for it but didn't find anything. > > Anybody could clear this out, > > Thanks, > > Pieter > You could work on the safe side and place your connection closing code in
the Finally block, since that gets run anyways. -------------------------------------------------------------------------------- All that glitters has a high refractive index. www.mendhak.com Show quote "Pieter" <pietercou***@hotmail.com> wrote in message news:%23zVRFgT4FHA.3312@TK2MSFTNGP09.phx.gbl... > Hi, > > An SqlDataAdapter always opens its Conection and closes it automaticly. > But does it Close the connection also when an exception occured? > > I tried to test it, and the connection was everytime closes, but I don't > knwo if this would happen with every type of exception... I googled around > for it but didn't find anything. > > Anybody could clear this out, > > Thanks, > > Pieter > |
|||||||||||||||||||||||