![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
Don't believe all your read on the internet., = )But I don't really know which one I can trust or untrust... |
|
The .NET framework will close the connection when your method ends (or goes out of the "{ ... }" ). The garbage collector will do this for you. But, yes you should close it as a good practice. I dind't know this, but I know "Mr. Garbage" from my Java-Learning-Book |
|
You could do a second try - catch - finally inside your try - catch. Eg. try // your old try-catch { OleDbConnection conn = new OleDbConnection(connectionString); try { conn.open(); //do your sql stuff here... Execute sql statements etc... } catch ( Exception eeee ) { // It went wrong... } finally { // Close the connection. This will always run. conn.close(); } } catch (...) // your old try - catch Here is a short article. It's C#, but it will do: http://msdn.microsoft.com/library/de...ogether_PG.asp I have the try/catch-system from my Java-Learning-Book. I searched for |
#3
| |||
| |||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |