Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ASP.NET locks files
Message
De
14/05/2006 09:41:57
 
 
À
13/05/2006 20:33:44
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Versions des environnements
Environment:
VB 8.0
Divers
Thread ID:
01121566
Message ID:
01121750
Vues:
20
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform