Understanding the ODBCDirect Object Model

   

The ODBCDirect object model is essentially a subset of the Data Access Objects (DAO) object model. However, it contains none of the Microsoft Jet database-specific objects (User, Group, Container, Document), it's missing the database definition objects (TableDef and Relation), and it has one new object, Connection. With the Connection object, your application can open multiple asynchronous connections against multiple databases and complete other tasks while the connection is busy.

The following drawing shows the ODBCDirect object model.

There are nine objects in the ODBCDirect object model, as listed here.

  • DBEngine object   This base ODBCDirect object holds all of the model's other objects and maintains engine options.

  • Workspace object   Defines and manages the current user session. Contains information on open databases and provides mechanisms for simultaneous transactions.

  • Database object   Represents an ODBC database with at least one open connection.

  • Connection object   Represents a connection to an ODBC database, including data source, user name, password, and default database.

  • QueryDef object   Represents a stored SQL query statement, with zero or more parameters, maintained in an ODBC database.

  • Recordset object   Represents a query result set with cursor. ODBCDirect has five types of Recordset objects: table, dynaset, snapshot, forward-only, and dynamic.

    For More Information   For more information on Recordset objects, cursor types, and how your application can use them, see Choosing and Managing Cursors in Chapter 7 of this book.

  • Field   Represents a field in a table, query, index, relation, or recordset. A Field object contains data, and you can use it to read data from a record or write data to a record.

  • Parameter   Represents a value associated with a QueryDef object. Query parameters can be input, output, or both.

  • Error   Contains information about an error that occurred during an ODBCDirect operation. When more than one error occurs during a single ODBCDirect operation, each individual error is represented by a separate Error object.