I came across several articles that said a global connection was a very bad
idea so I wont do it. Just wigs me out to watch SQL generate 30+ connections
in the pool for a single user request post back when I know for a fact I’m
creating, opening, closing, and disposing of all the connections. There are
8 user controls on my page, why 30 connections are created when I only need 8
or 10 is beyond me. I figured it was b/c each user control has a
SqlConnection objConnection = new
SqlConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]);.

Signature
JP
.NET Software Developer
> > Is there a way to create an application wide connection object in C# so I
> > don't have to create a new one for every page? My issue is that while I can
[quoted text clipped - 28 lines]
>
> Damien
Damien - 13 Jul 2007 08:37 GMT
> I came across several articles that said a global connection was a very bad
> idea so I wont do it. Just wigs me out to watch SQL generate 30+ connections
[quoted text clipped - 5 lines]
>
> SqlConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]);.
Yeah, but how many connections does it open for 100 users? Optimizing
for 1 user is rarely a model for a succesful website :-) I'd just
emphasize again to make sure that every opened connection does get
explicitly closed/disposed. Went mad once in one project trying to
find the connection leak once lots of users were using the site.
Course, couldn't reproduce it on my machine with only me using it.
Damien