<% If Request("DontFrame")<>1 Then Response.Redirect "/iissamples/sdk/asp/docs/SampFram.asp?ovfile=/iishelp/iis/htm/sdk/samp3unt.asp&srcfile=Database/SimpleQuery" %> Simple Query

Simple Query

Databases can be very complicated systems, and data access tools must be powerful and responsive enough to accomplish the often difficult and exacting tasks that you require. However, it is equally important to you that simple database access tasks be easy to accomplish.

This sample demonstrates how ADO provides just such a solution. 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 ODBC data source, 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 ODBC data source connection are closed. It's that simple.

Note ODBC must be properly configured on the server before this sample will run properly.


© 1997 by Microsoft Corporation. All rights reserved.