Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Design Question
Message
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Titre:
Divers
Thread ID:
01389713
Message ID:
01389747
Vues:
61
>>>>I have a Data Access class in which I have ExecuteQuery, ExecuteNonQuery, ExecuteReader and ExecuteScalar methods. All of these call a private _GetConnection method which returns a SqlConnection object.
>>>>
>>>>The problem is that the connection object is never exposed to the class which uses this class. So how do I close the connection? I was thinking of creating a private field level variable that would hold the connection, but I'm not sure if this is the best way.
>>>>
>>>>Anyone wanna point me in the right direction?
>>>I don't know if this is possible
>>>
>>>using _GetConnection()
>>>
>>>end using
>>
>>
>>Huh?
>
>In other words, if you use this syntax, the connection object is automatically closed.

Ok, I see. But I'm not sure how to use it in my class. Can you elaborate a bit?
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform