MDAC 2.5 SDK - Technical Articles


 

Migrating from DAO to ADO

Using ADO with the Microsoft Jet Provider

Alyssa Henry

June 1999

Introduction

This document is a guide to revising code that uses Microsoft® Data Access Objects (DAO) into code that uses Microsoft ActiveX® Data Objects (ADO). It also guides those who are writing new code using ADO with the OLE DB Provider for Microsoft Jet (Microsoft Jet Provider). It compares the general differences between DAO and ADO and details the mapping of objects, properties, and methods from DAO to ADO. It also highlights functional or semantic differences between similarly named methods or properties.

This document assumes that you have already decided to use ADO instead of DAO to access a Microsoft Jet database, or that you are investigating what it will take to port your code from DAO to ADO. It covers some of the advantages of using ADO over DAO. It describes many features of the Microsoft Jet Provider and demonstrates how to use them with ADO. (The ADO documentation is meant to be provider-neutral, so it lacks much of this information.) This document does not attempt to provide in-depth detail on particular objects, properties, or methods. Refer to the online documentation provided with DAO and ADO for specific details on a particular item.

Contents

General Differences

ADO: Data Manipulation

ADOX: Data Definition and Security

JRO: Replication

Getting Started

Opening a Database

Microsoft Jet Databases

Setting Microsoft Jet Options

Secured Microsoft Jet Databases

External Databases

The Current Microsoft Access Database

Retrieving and Modifying Data

Opening a Recordset

Navigating Within a Recordset

Finding Records in a Recordset

Filtering and Sorting Data in a Recordset

Updating Data in a Recordset

Executing Queries

Defining and Retrieving a Database’s Schema

Creating a Database

Retrieving Schema Information

Creating and Modifying Tables

Creating an Index

Defining Keys and Relationships

Creating and Modifying Queries

Security

Changing a Password

Creating Users and Groups

Adding a User to a Group

Setting Permissions

Determining an Object's Owner

Replication

Making a Database Replicable

Making Objects Local or Replicable

Creating a Replica

Creating a Partial Replica

Listing Filters

Synchronizing Data

Listing Synchronization Conflict Tables

Miscellaneous

Handling Errors

Using Transactions

Compacting a Database

Refreshing the Cache

New Features in ADO, ADOX, and JRO

Creatable Recordset Objects

Microsoft Data Links

User Roster

Enhanced Auto-Increment (Counter) Columns

Replication

Obsolete Properties and Methods

Conclusion

Appendix A: DAO to ADO Quick Reference

Appendix B: Microsoft Jet 4.0 OLE DB Properties Reference

ADO Connection Properties

ADO Recordset Properties

ADOX Table Properties

ADOX Column Properties

ADOX Index Properties

Appendix C: Microsoft Jet 4.0 OLE DB Provider Defined Property Values

Appendix D: Microsoft Jet 4.0 ANSI Reserved Words