Implementing ADO with Various Development Languages

The ADO Rosetta Stone

By Don Willits

July 1998

Microsoft® ActiveX® Data Objects (ADO) is a language-neutral object model that is the keystone of Microsoft's Universal Data Access strategy. Because it is language neutral and accommodates a variety of development languages, it is difficult to present the practical usage for each environment. This paper is a discussion of the complexities inherent to using ADO within various languages and implementation mechanisms within those languages.

To facilitate this discussion of ADO, take a lesson from the Rosetta Stone, a slab of black basalt that provided scholars with their first significant key to deciphering ancient Egyptian hieroglyphics. The Rosetta Stone was discovered in 1799 and appeared to contain one message (a group of priests praising their rulers for eliminating overdue taxes in the year 196 BC) in three languages: Greek, demonic characters, and Egyptian hieroglyphics. Because scholars knew Greek, they enthusiastically attempted to use the Rosetta Stone to decipher the hieroglyphics. Twenty years later, French scholar Jean Champollion produced a dictionary of Egyptian hieroglyphics after rigorous comparison of the hieroglyphics to the Greek.

In the spirit of Champollion's accomplishment the following pages describe how to implement ADO applications using Microsoft® Visual Basic® for Applications (VBA); Microsoft® Visual C++® (Visual C++); Java; Microsoft® Visual Basic® Scripting Edition (VBScript), and Microsoft® JScript®. In this case, VBA is the "Greek text"; you can use it as the base from which to learn about the other languages.

Numerous code listings are included in the text, as well as two sets of code examples in an accompanying zip file. The first set contains all the code listings presented in this document within working projects built with Microsoft® Visual Studio® 97 and the Data Access 2.0 SDK (which includes ADO 2.0). In each of these examples, you will find files named "LISTING" which contain the actual code samples. The second set, the Rosetta Stone samples, implement several common ADO scenarios and are ported to a variety of development languages and environments.

The paper was written against ADO 1.5 and ADO 2.0 using Visual Studio 97. Updates will be provided, as appropriate, for new features introduced with subsequent releases of either product. The latest version of this paper is available at http://www.microsoft.com/data.

This white paper does not discuss the ADO object model or its objects, methods, properties, or syntax. If you are not already familiar with ADO, refer to the ADO documentation for more information.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.