Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Connection Question
Message
From
17/04/2008 11:45:47
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01311461
Message ID:
01311469
Views:
15
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform