

ASP ADVANCED
This chapter introduces the
ActiveX Data Objects (ADO). The
first section provides an overview of these objects.
The second section gives you a step-by-step guide to using the ADO
to retrieve and store data in a database.
Finally, in the third section, you are formally introduced to a
particularly important ADO object: the connection object.
Using the ActiveX Data
Objects (ADO), you can store and retrieve data from a
variety of data providers. For
example, you can use the ADO to access information from Microsoft Access
and the Microsoft SQL and Oracle database servers, You can even use the
ADO to retrieve information from a Microsoft Excel spreadsheet.
In this book, you learn how
to use the ADO with Microsoft SQL Server.
All the examples assume that this database is being used.
However, you should realize that much of what you learn in the
following chapters is transferable to other databases as well.
In Part III, "Working
with Data: SQL," you learned how to use Structured Query Language
(SQL). Starting with this
chapter, you put this knowledge to good use.
The emphasis is on using SQL with the ADO to store and retrieve
data from a database. This
combination of the ADO and SQL is powerful.
The ActiveX Data Objects
consists of seven independent objects. The
following list names these objects and provides a brief explanation of
their functions:
- Connection
object. Represents
a unique session with a data source.
For example, you can use the Connection object to open a
connection to Microsoft SQL Server.
- Recordset
object. Represents
records from a data provider. For
example, you can use the Recordset object to alter the records
contained in a SQL Server table.
-
Field object. Represents
an individual field in a Recordset.
- command object.
Represents a command.
For example, you can use the Command object to execute a SQL
stored procedure or a parameterized query.
- Parameter
object.
Represents an individual parameter in a SQL stored procedure or
parameterized query.
- Property
object.
Represents data-provider-specific properties.
- Error object.
Represents ADO errors.
When
using the ADO, you'll be most directly interacting with the
connection,Recordset, and Command objects.
This chapter provides a detailed overview of the Connection object.
In the next two chapters, you learn how to use both the Recordset
and Command objects. First,
however, you must learn how to configure your server to use the ADO.
|