How Do I Add a Property in My Provider?

Find the property group and property ID for the property you want. (See in the OLE DB Programmer's Reference.)

In the provider code generated by the Wizard, find the property map corresponding to the property group. (The name of the property group usually corresponds to the name of the object. Command and rowset properties can be found in the command or rowset; data source and initialization properties can be found in the data source object.)

In the property map, add a PROPERTY_INFO_ENTRY macro. PROPERTY_INFO_ENTRY takes four parameters:

  • The property ID corresponding to your property. You must remove the first seven characters ("DBPROP_") from the front of the property name. For example, if you want to add DBPROP_MAXROWS, pass MAXROWS as the first element.

  • The variant type of the property (find in in the OLE DB Programmer's Reference). Enter the VT_ type (such as  VT_BOOL or VT_I2) corresponding to the data type.

  • Flags to indicate whether the property is readable and writeable and the group it belongs to. For example, the following code indicates a read/write property belonging to the rowset group:

    DBPROPFLAGS_ROWSET | DBPROPFLAGS_READ | DBPROPFLAGS_WRITE
    
  • The base value of the property. This might be VARIANT_FALSE for a boolean type or zero for an integer type, for example. The property will have this value unless someone changes it.

    Note   Some properties are connected or "chained" to other properties, such as bookmarks or updating. When a consumer sets one property to true, another property may also be set. The OLE DB Provider templates support this through the method CUtlProps::OnPropertyChanged. For an example of how to use OnPropertyChanged, see the .