Simple Query

Overview

Although databases can be very complicated systems, and data access tools must be powerful and responsive, it is equally important that simple database access tasks be easy to accomplish. This sample demonstrates how ADO provides an easy way to perform such a task.

Code Tour

The goal of this sample application is to retrieve a small recordset from a Microsoft® Access database, and print the results. The first step is to create an instance of the Connection object, using the Server.CreateObject method. The sample uses the Connection object instance to open the OLE DB data provider, then uses the Connection instance again to execute a SQL SELECT command to retrieve all the records from the Authors table. The script finishes by iterating through the returned recordset collection and displaying the results. Afterwards, both the recordset and OLE DB data source connection are closed.

Important   OLE DB must be properly configured on the server for this sample to run properly.

Location

The VBScript and JScript versions of this script are available in the IIS samples directory, at ...\asp\database\SimpleQuery_VBScript.asp and ...\asp\database\SimpleQuery_JScript.asp.