Applications Home|Email

 Generic Database Routine

This is a small but handy database routine to use with Classic ASP and the database of your choice. The routine supports all basic database calls like select queries, insert, update and delete by using the ADO Recordset Open method.

First include the routine on the asp page where you are doing your database operations:

<!--#include file="DB.asp"-->

Some examples passing default values for the ADO cursor properties:

aRecords = DB("SELECT * FROM MyTable", "GETROWS", 0, 2, 1)

Set oRs = DB("SELECT * FROM MyTable", "RECORDSET", 0, 2, 1)

sGetString = DB("SELECT * FROM MyTable", "GetString", 0, 2, 1)

bSuccess = DB("DELETE FROM MyTable WHERE id=43", "BOOLEAN", 0, 2, 1)

Out of the box this routine supports SQL Server 2008, but you can add your own connectionstrings as you like.

View DB.txt with code examples

Therefore: For that or this for it.
© www.u229.no