Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Closing database & recordset connections - ASP / Access / SQL

Featured Replies

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.