← Back to Database Operations with ASPPY
Lesson 1

Opening a Database Connection

Database Operations with ASPPY · Created 2026-06-01 13:34:28

Every database operation in ASPPY starts with a connection to a SQLite file.

Standard Connection Pattern
Dim conn
Set conn = Server.CreateObject('ADODB.Connection')
conn.Open 'Provider=SQLite;Data Source=' & Server.MapPath('data/app.db')

Using the App Helper (recommended)
Set conn = OpenAppConnection()

Connection Lifecycle
1. Create object - Server.CreateObject('ADODB.Connection')
2. Open - conn.Open connectionString
3. Use - conn.Execute sql or Set rs = conn.Execute(sql)
4. Close - conn.Close
5. Release - Set conn = Nothing

ASPPY Specifics
Uses SQLite via ADODB provider
Database file lives in www/data/
OpenAppConnection() is included from db.asp
conn.Execute returns a Recordset for SELECT queries

Live Demo →