ADO Object Model

ActiveX Data Objects (ADO) is OLE DB's main object model. ADO consists of three object models, each providing a different area of functionality (see Table 10-1). Because of this, only the objects necessary for a specific task need to be loaded at any given time.

^^ Note: If you're interested in programming Microsoft Office Access databases using the older Data Access Objects (DAO) (and this may be a valid requirement if you happen to be involved in a DAO to ADO conversion project), AppendixA.pdf in the book's downloadable files contains numerous DAO programming examples.

Table 10-1: Components of the ActiveX Data Object Model

Object Model

What It's Used For

ADODB — ActiveX Data Objects

Data manipulation

Access and manipulate data through an OLE DB provider. With ADO objects you can connect to a data source and read, add, update, or delete data.

ADOX — ADO Extensions for DDL and Security

Data definition and security

With ADOX objects you can define data such as tables, views, or indexes, as well as create and modify users and groups.

JRO — Jet and Replication Objects

Replication

With JRO objects you can create, modify, and synchronize replicas. JRO can be used only with Microsoft Jet databases.

The ADODB library is the most commonly used object library, as it allows you to retrieve and manipulate data. Its objects are presented in Figure 10-1. If you installed Microsoft Office Access 2003 (or any other application in Office 2003), you should have ADO 2.5 installed on your computer.

Creating and Manipulating Databases with ADO

Creating and Manipulating Databases with ADO

Figure 10-1: ADO Object Model.

To make sure that you have a reference to the ADODB Object Library, or to set up a reference to the ADOX and JRO Object Libraries, perform the tasks outlined in Hands-On 10-1.

(Hands-On 10-1: Setting Up a Reference to ADO Object Libraries

1. In the left pane of the Database window, select the Modules button and click Create.

2. From the Microsoft Visual Basic menu bar, choose Tools | References.

3. Make sure that Microsoft ActiveX Data Objects 2.5 Library is selected. Locate the entry by scrolling down the list, and click the check box to the left of the name to select it.

4. Click the check box to the left of Microsoft ADO Ext. 2.5 for DDL and Security.

5. From the list, select Microsoft Jet and Replication Objects 2.5 Library.

+1 0

Post a comment