Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ASP.NET locks files
Message
From
14/05/2006 09:41:57
 
 
To
13/05/2006 20:33:44
General information
Forum:
ASP.NET
Category:
Databases
Environment versions
Environment:
VB 8.0
Miscellaneous
Thread ID:
01121566
Message ID:
01121750
Views:
12
Sarosh,

>Shouldn't that (oConnection.Close() etc.) and other release resources type stuff be in the finally block?

Well, it typically all depends on what you're doing I suppose. In this particular case, Michel was simply reporting the error in his catch. Since the DataAdapter.Fill() command is supposed to automatically close the connection when it's done, it's not necessary to have one in a finally block also, only when something goes wrong with the .Fill().

~~Bonnie




>Hi!
>
>Shouldn't that (oConnection.Close() etc.) and other release resources type stuff be in the finally block?
>
>Sarosh
>
>
>>Cool! Glad it worked! =)
>>
>>~~Bonnie
>>
>>
>>>>Probably all you need to do is to just make sure you close your connection in your catch:
>>>>
>>>>            Catch loError As Exception
>>>>                oApp.cError = oApp.ErrorSetup(loError, oApp.Debug(cSQL))
>>>>                oConnection.Close()
>>>>            End Try
>>>>
>>>
>>>Wow! That did it.
>>>
>>>I have found that this got locked for a few minutes and went away by itself. So, once an error occured, the lock was persisting for a few minutes. Now, with this adjustment, it never happens. Thanks
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform