Does anyone know what is best suited for closing connections in Regular ASP, does it need to be done right after every sql request or only at the bottom of the page?
For example, this is normal:
sql = "SELECT COUNT(*) AS num FROM tblUSER" set rstemp = connTemp.execute(sql) theCount = rstemp("num") sql = "SELECT COUNT(*) AS num2 FROM tblCUSTOMER" set rstemp = connTemp.execute(sql) theCount2 = rstemp("num2") rstemp.close set rstemp = nothing
or should I close the connection after each connection as follows:
sql = "SELECT COUNT(*) AS num FROM tblUSER" set rstemp = connTemp.execute(sql) theCount = rstemp("num") rstemp.close set rstemp = nothing sql = "SELECT COUNT(*) AS num2 FROM tblCUSTOMER" set rstemp = connTemp.execute(sql) theCount2 = rstemp("num2") rstemp.close set rstemp = nothing
(If we close the connection after each request, whether it will use more or less resources, increase or decrease locks, etc.)
source share