• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Part III: Programming with ADO

Part III: Programming with ADO

ActiveX Data Objects (ADO) are required for all Microsoft Visual Basic for Applications (VBA) database access. There are currently several versions of ADO in use. Version 2.1 is supplied with Microsoft Office 2000 and Microsoft Access 2000, and version 2.5 comes with Microsoft Windows 2000 and Microsoft Office XP. The differences, at least with regard to their use in Access projects, are minimal. ADO 2.5 contains two new objects, Record and Stream. Both are designed for more complex programming tasks and nonrelational databases. These objects are not described further in this section. ADO 2.6 is supplied with Microsoft SQL Server 2000. ADO 2.7, better known as ADO.NET, is supplied with Visual Studio .NET. For more information on Microsoft ADO technology, visit http://www.microsoft.com/data/ for updates, help files, or Software Development Kits (SDK).

The ADO object model consists of only a few objects and is easily maintained. The individual objects are the subject matter of the following chapters.

The Connection object contains information about the connection to the data source, and it is used to determine which data source is accessed with which OLE DB driver. Here, the user name, password, and other parameters for controlling the connection can be entered. Chapter 12, “ Connection Objects,” also describes error handling for ADO programs. ADO errors that occur when running ADO operations can be retrieved from the Connection object’s Errors list.

Recordset objects have been designed for accessing records and are described in Chapter 13, “ Recordset Objects.” A record’s individual fields are addressed through a Recordset object’s Fields list. The records for a Recordset object are selected by means of SQL queries.

Using Command objects, queries can be run with or without parameters or action queries (UPDATE, DELETE, and so on). Chapter 14, “ Command Objects,” covers these objects in detail. The majority of ADO objects transmit events by which they indicate their current activity. You can intercept these events in your programs and respond accordingly.

Using ADO events, programs can further control the status of ADO connections, transactions, or recordsets without the necessity of checking the properties of these objects every step of the way. The ADO event model is explained in Chapter 15, “ADO Events.”



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint