John Baird
Coatesville, Pennsylvania, United States
General information
Category:
Coding, syntax and commands
>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..
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only