ADO Library
Kenneth W. Richards
Orvado Technologies
Introduction
The ADO library handles all of the database calls the website makes using
library functions. The only two methods you should ever use from this
library are adoExecute and adoOpenRecordset. These
two methods execute a statement or procedure. adoOpenRecordset will return
an ADODB.Recordset object whereas the other does not.
This file is included in site_lib.asp which, conversely, is
included on nearly every page on the site since database calls are needed
on nearly every page. The library encapsulates the minutia of creating
ADODB objects and opening a database connection so all you need to worry
about is writing proper SQL queries and passing the right parameters to
your stored procedures.
The connection string for the database is stored in the global.asa
file at the root of your web server. This is the only place the database
string is stored. The library will read the connection string and use this
to make new connections to the database server.
adoRecordsetErrors (sub)
Displays all of the errors in the Errors collection of the
recordset. This function is called automtically when opening a recordset via the
adoOpenRecordset method creates an error.
For Internal Use Only
adoConnect (sub)
Opens a new connection to the database (configured in global.asa)
unless a connection has already been opened. No need to do pooling
since that is handled by IIS internally.
For Internal Use Only
adoExecute (sub)
Executes a query without returning a recordset. This method will
return a number indicating the number of rows that were affected
by the query.
Parameters
- sStat
- Transact-SQL statement to be run by the database server.
Returns
Nothing
adoOpenRecordset (function)
Opens a forward-only recordset from the database using the
supplied query (sQuery).
Parameters
- sStat
- Transact-SQL statement to be run by the database server.
Returns
ADODB.Recordset object containing the results of the SQL statement.
adoDisconnect (sub)
Disconnect from the database here
Parameters
None
Returns
Nothing
Summary
All of your database calls should go through the ado_lib.asp library.
There is no reason to create your own database connection. By keeping all database
calls using the same library, it will allow us to easily upgrade and improve the
performance of ASP nuke as needed.
It will also allow us to write custom error handlers which will appropriately
log any errors that occur due to our database calls. If you have a need to create
a database connection on your own, you should have this approved before you complete
your module, otherwise it may not be accepted as an approved ASP Nuke module.
Last Updated: Sep 29, 2003
|