ActiveX™ Data Objects (ADO) enables you to write a client application to access and manipulate data in a database server through a provider. ADO’s primary benefits are ease of use, high speed, low memory overhead, and a small disk footprint. This help file is for ADODB, an implementation of ADO optimized for use with Microsoft OLE DB providers, including the Microsoft ODBC Provider for OLE DB.
In ADO, the Recordset object is the main interface to data. An example of the minimal Microsoft® Visual Basic® Scripting Edition code to generate a Recordset from an ODBC data source is as follows:
set rstMain = CreateObject("ADODB.Recordset")
rstMain.Open "SELECT * FROM authors", _
"DATABASE=pubs;UID=sa;PWD=;DSN=Publishers"
This generates a forward-only, read-only Recordset object. A slightly more functional Recordset can be generated as follows:
set rstMain = CreateObject("ADODB.Recordset")
rstMain.Open "SELECT * FROM authors", _
"DATABASE=pubs;UID=sa;PWD=;DSN=Publishers",
adOpenKeyset, adLockBatchOptimistic
This creates a fully scrollable and batch-updatable Recordset.
Note For applications that use Visual Basic Scripting Edition (for example, Microsoft® Active Server Pages), you must include the Adovbs.inc file in your code in order to call ADO constants by name. (Use Adojavas.inc for Microsoft JScript™.) In your code, you should always refer to constants by name rather than by value since the values may change from one version to the next.
In ADO, the object hierarchy is de-emphasized. Unlike Data Access Objects (DAO) or Remote Data Objects (RDO), you no longer have to navigate through a hierarchy to create objects because most ADO objects can be independently created. This allows you to create and track only the objects you need. This model also results in fewer ADO objects and thus a smaller working set.
ADO supports key features for building client/server and web-based applications, including the following:
Note While ADODB supports these features, the underlying providers and drivers called by ADODB may not. Consult the documentation for the underlying providers and drivers to determine what functionality they support.
For the latest information on ADO, visit the Microsoft ADO web page. For an example of how to use ADO, see the AdventureWorks sample application available with Microsoft Active Server Pages. For more information on OLE DB providers including the ODBC Provider for OLE DB, see the documentation for the Microsoft® OLE DB SDK or visit the Microsoft OLE DB web page.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.