[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Closing a connection which is in Session state and the connection is still open in Enterprise Manager

Posted on 2005-05-11
4
Medium Priority
?
363 Views
Last Modified: 2013-12-03
Hi, i've got a web application which creates and open a connection in the page load and then stores it in the session state.

the problem is that when i want to close the connection :
SqlConnection mySqlConnection = (SqlConnection) Session["mySqlConnection"];
mySqlConnection.Close();
mySqlConnection.Dispose();
Session["mySqlConnection"] = null;

it is still visible and open in Enterprise Manager

the real problem is that when there are a lot of activity on this application, all the connections stay opened and so the pool becomes full and noone can connect =/

what's the problem ?

0
Comment
Question by:ennixo
  • 2
  • 2
4 Comments
 
LVL 7

Accepted Solution

by:
Fred Goodwin earned 1000 total points
ID: 13984050
you should open and close the connection as fast as possible.  I wouldnt store an open connection in the session.  You should only have the connection open long enough to make the database call and return your data.  Then close the connection and manipulate your data in whatever way you need.
0
 
LVL 5

Author Comment

by:ennixo
ID: 13984106
i agree and i'll change this, do you think the fact to store it in the Session state can make it "unclosable" ?
0
 
LVL 5

Author Comment

by:ennixo
ID: 13984186
i changed it, now i don't see the connections in Enterprise Manager since it is closed just after executing commands.

thank you =)
0
 
LVL 7

Expert Comment

by:Fred Goodwin
ID: 13985200
no problem.  Im glad that I could help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

826 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question