Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Connection Question
Message
De
17/04/2008 11:45:47
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01311461
Message ID:
01311469
Vues:
16
Kevin,

>Is there any benefit to maintaining a reference to a connection object in a property on my class?
>
>I'm thinking that once I'v established a connection, if I maintained it, then there would be a performance gain rather
>than reconnecting for each add, update, delete and query.
>
>Inquiring minds wanna know.


It isn't a bad idea to maintain a reference to the connection string, but I am pretty sure most would suggest you shouldn't keep your connection open. You could maintain a reference to a configured connection object so long as you still close it after you use it each time.

It might be even better to have a reference to your dataAccess class that is instantiated already and knows about its own connection object. The application doesn't really need to know this.

I hope that made sense and hopefully I understood your question.
Tim
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform