ADO Disconnected Recordsets

Why

ADO stands for ActiveX Data Objects. The MSDN Library says that this will eventually make Data Access Objects (DAO) obsolete. ADO enables you to write an application to access and manipulate data in a database server through an OLE DB data provider. ADO's primary benefits are high speed, ease of use, low memory overhead, and a small disk footprint.

What

A disconnected recordset can later connect to the database and update multiple records in a batch. This allows for fast recordset creation in memory and for passing between components in distributed systems. This is a powerful capability of ADO.

How

Pseudocode


create recordset instance
add fields (with data types)
open recordset
for each record
	add new record
	add field values
next
do work with recordset
close recordset

Implementation details

Microsoft ADO is very easy to use in VB, but more difficult in C++. The use of Dual Interfaces makes it much easier to use in VB but in C++ about 10 times more lines of code are required to achive the same results with little runtime speed improvements. In C++ HESULTs must be checked after virtually every ADO function call and memory management must be done correctly.

Download

In the download section my examples are included, they are simple to build and demonstrate the key features.

References

Chapter 6: ActiveX Data Objects. Book Extracts. MSDN Library April 2001 (available online).

Back to index.