編輯

共用方式為


Use ActiveX Data Objects

Applies to: Access 2013, Office 2013

Microsoft Access provides three object models to use in the creation, maintaining, and managing of your Access databases and their related data by using Visual Basic.

Microsoft ActiveX Data Objects (ADO)

ADO contains the objects needed to create, maintain, and delete records in a given datasource.

Microsoft ADO ext. for DDL and security (ADOX)

ADOX provides the Data Definition Language (DDL) objects needed to create a new database and its contained objects in addition to the objects needed to manage security.

Microsoft Jet and Replication Objects 2.5 library (JRO)

Because ADO objects were designed to work with many databases in addition to Microsoft Jet databases, functionality specific to Jet was broken out into the JRO library.

The following table lists the functionality provided by each compared to DAO.

Functionality

DAO

ADO1

ADOX2

JRO
(MDBs only)

Create Recordsets.

X

X

Edit Startup properties.

X

X**

Support ANSI92 SQL.***

X

X

Create tables.

X

X

Create new database.

X

X*

Edit existing table properties.

X

X

Create table relationships.

X

X*

Edit security settings.

X

X*

Support for Compression attribute for column data.

X

Edit stored, basic SQL queries or views.

X

X*

Create permanent queries that are accessible only through code.

X*

Create queries accessible through database container/UI and code.

X

Compact/encode database.

X

X4

Refresh cache.

X

X

Make database replicable.

X

X3

Make database replicas.

X

X3

Synchronize replicas.

X

X3

Edit database properties.

X

Create custom database properties.

X

Edit table column properties.

X

* Only available when working with Microsoft Access databases. Future versions of the SQL Provider may provide this functionality in Microsoft Access projects (.adp).

** Only available when working with Access projects.

*** Although the Access database engine does support some ANSI 92 SQL, it is not yet fully ANSI92-compliant.

1 Uses Connection object to reference database.

2 Uses Catalog object to reference database.

3 Uses Replica object to reference database.

4 Uses JetEngine object to reference database.

Note

Unlike DAO, ADO and ADOX objects can perform the marked actions in databases other than Jet as long as the provider for those databases supports that action.