ASP.net to SQL server , connection not closing even after Log out

T

thomson

Hi all,
In my application i use efficient use of the DAL, but for eg
4 users has been connected to the application, it shows 4 connections
established, when all the users logout, and again logs in it shows 8
connections established, What should i do inorder to release all my
connections when i logout, even though in my application i have closed
the connections appropriately

Thanks in Advance

thomson
 
T

thomson

iam using Session.Abandon(), while the user logs out, but still the
connection is not getting closed


Regards

thomson
 
J

Jason Kester

Why would you expect database connections to close themselves?
Anything you open will remain so until you explicitly close it. If you
end a request with that database connection still alive, it will sit
there awaiting further instructions forever (or until garbage
collection gives up on it, which is essentially forever in machine
time.)

If you don't want your code to leak, wrap every database connection in
a using{} block and explicitly close it when you have finished your
operation. Otherwise, you'll see exactly what you're seeing from your
"efficient" DAL!

Jason Kester
 
E

Edwin Knoppert

Your topic title versus contents confused me.
Like the other responded, you should close every connection.
The IDisposed stuff might be a help as well.
I'm using a class which on destruction frees the connection it made.
I can force that but i can also wait until ISS destroys it.
Since then no more odd events.

At first, i thought you where talking about user (http)connections.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top