April 2, 200917 yr Hi there, having had to amend some of my DSN connections to DSN-Less ones for a new server I am using it come to my attention that some of my pages do not close off the connections correctly. What is the correct / best way of closing a database connection when you are opening it with the following (which is held in an include file) connecting to a MS-SQL Server? <%Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "PROVIDER=SQLOLEDB; DATA SOURCE=SOURCEADDRESS; INITIAL CATALOG=DATABASENAME; USER ID=USERNAME; PASSWORD=PASSWORD"%> I then have 2 recordets (rs and rs2) pulling in the required data then at the end of the HTML tags I put the following to close off the recordsets: <% rs.Close() Set rs = Nothing %> <% rs2.Close() Set rs2 = Nothing %> Is it just a case of adding this below these two? <% conn.Close Set conn = Nothing %> and that will close off the connection?
Create an account or sign in to comment