I have a ASP.net application in which I do a query on a SQL Server Database. When the query ends, I do the following :
reader.Close();
reader.Dispose();
conn.Close();
conn.Dispose();
And still when I go on SQL Server and does :
SELECT
DB_NAME(dbid) as DBName,
COUNT(dbid) as NoOfConnections,
loginame as LoginName
FROM
sys.sysprocesses
WHERE
dbid > 0
GROUP BY
dbid, loginame
I can see the 'NoOfConnections' that keeps increasing while I have closed the connection and there is a moment where I'll get an error because I have over 100 connections opened. How do I close the connections properly?