JavaScript EditorDhtml editor     Free javascript download 

Main Page

This topic demonstrates the use of database attributes to simplify database operations.

The basic way to access information from a database is to create a command (or table) class and a user record class for a particular table in the database. The database attributes simplify some of the template declarations that you previously had to do.

To demonstrate the use of database attributes, the following sections show two equivalent table and user record class declarations: the first uses attributes and the second uses OLE DB Templates. Such declaration code is typically placed in a header file named for the table or command object, for example, Authors.h.

By comparing the two files, you can see how much simpler it is to use attributes. Among the differences are:

The attributes inject a user record class declaration for you. The user record class is equivalent to CAuthorsNoAttrAccessor in the template declaration. If your table class is CAuthors, the injected user record class is named CAuthorsAccessor, and you can only view its declaration in injected code. For more information, see "Attribute-Injected User Record Classes" in User Records.

Note that in both the attributed and the templated code, you must set rowset properties using CDBPropSet::AddProperty.

For information about the attributes discussed in this topic, see OLE DB Consumer Attributes.

Expand imageTable and Accessor Declaration Using Attributes

Expand imageTable and Accessor Declaration Using Templates

Expand imageSee Also

JavaScript EditorDhtml editor     Free javascript download