John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Catégorie:
Code, syntaxe and commandes
>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
If you're using Sql server and connection pooling, sql server maintains this for you..
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement