class.aspdb_sql.asp - v1.0.0 - PHPLIB's DB_Sql format in ASP language


<!-- #include file="class.aspdb_sql.asp" -->
	var dbs = new DB_Sql( );
	dbs.dsn( "DSN=project;UID=root;PWD=manager" );

	dbs.query( "SELECT * FROM BOOKS" );
	while ( dbs.next_record() ) {
		Response.Write( dbs.f("BOOK_TITLE") + "\n" );


class.aspdb_sql.asp permits using DB_Sql format (PHPLIB) in ASP language.


DB_Sql( [$dsn_string] )

Constructor. When creating an instance, you may optionally supply a DSN connect string

dsn( $dsn_string )

Connecting to database using DSN connect string.

query( $query_string )

query_string is a SQL statement that is sent to the database.
If the query is syntactically incorrect (no valid result id is being produced), halt() is called with a meaningful error message.

next_record( )

The method next_record() advances the cursor through the current query result and updates the Record and Row instance variables

num_rows( ), nf( )

The method num_rows() returns the number of rows returned by the current SELECT query.

affected_rows( )

This method is under construction. Not implemented yet.

num_fields( )

The method num_fields() returns the number of columns returned by the current query.

np( )

The method np() prints the number of rows returned by the current query.

f( $field )

Returns the variable Record[$field].

p( $field )

Prints the variable Record[$field].

seek( [$pos] )

The method seek() positions the Row pointer within the result set. Useful for reading the same result set twice or otherwise jumping around within the result. $pos is not checked in any way for validity.

metadata( )

This method is under construction. Not implemented yet.

close( )

Free memory and close ADODB.recordset and ADODB.connection.


connect( )

Used internally to generate a Link_ID, if necessary.

halt( $msg )

Used by query() if the initial database connection cannot be made or the target database does not exist.

debug( )

Used internally by debuging.


You're reading it.


class.aspdb_sql.asp 1.0.0 - Aug 11, 2002 © RFK Solutions <>


CopyRight (c) 2002 RFK Solutions, All Rights Reserved.

The latest version of this class should be available from the following locations:

This program is free software; you can redistribute it and/or modify it under the GNU General Artistic License, with the following stipulations;

Changes or modifications must retain these Copyright statements. Changes or modifications must be submitted to the author.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Artistic License for more details. This software is distributed AS-IS.

Address Bug Reports or Comments to RFK Solutions,

ADODB_SQL Library for PHP4

PHP Base Library
Release phplib_7_2 (c) 2000-2001 Boris Erdmann (, Kristian Köhntopp ( and Sascha Schumann (