VS C# Best Practice Database Connection

From a best practice performance standpoint what is the best way to set this up? I need to create a control panel that will have several options that all pertain to doing various things to a single SQL database. My question is, should I write this routine so that it opens the database connection once when the control panel is fired up or should I open the database connection within each module called and close it upon exiting?  I am not sure of the cost overhead with opening a connection and then leaving it open. I will be using VS 2010 C# to create this application.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Let the pooling built in with most providers do it's thing.  You open and close the connections as they are needed, but let pooling decide if they stay open behind the scenes.  The time to acquire and release a connection from/to the pool is probably negligible.  And remember "performance" isn't just ticks, it's also scalability.  A DBA wouldn't be very happy if you're holding a mostly idle connection or worse, he probably has a job that kills idle connections after x minutes and that leaves you cleaning up your dead connection.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HuaMin ChenProblem resolverCommented:
Try to put this
		<add name="conn2" connectionString="Data Source=192.?.?.?\your_db_instance;Initial Catalog=your_db_schema;Integrated Security=False;User ID=your_db_login;Password=??????" providerName="System.Data.SqlClient"/>

Open in new window

within Web.config/app.config file in your project, to ensure the project will work fine with the database.
rwheeler23Author Commented:
Thanks. This is how I will proceed.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.