Compartir a través de


Setting Properties in Your Provider

Find the property group and property ID for the property you want. For more information, see OLE DB Properties 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_EX macro. PROPERTY_INFO_ENTRY_EX 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. If this is a custom property, pass the full GUID name (for example, DBMYPROP_MYPROPERTY).

  • The variant type of the property (in OLE DB Properties 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 writable and the group to which it belongs. 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 has this value unless it is changed.

    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 might also be set. The OLE DB provider templates support this through the method CUtlProps::OnPropertyChanged.

Properties Ignored by Microsoft OLE DB Providers

The Microsoft OLE DB Providers ignore the following OLE DB properties:

  • DBPROP_MAXROWS only works for read-only providers (that is, where DBPROP_IRowsetChange and DBPROP_IRowsetUpdate are false); otherwise this property is not supported.

  • DBPROP_MAXPENDINGROWS is ignored; the provider specifies its own limit.

  • DBPROP_MAXOPENROWS is ignored; the provider specifies its own limit.

  • DBPROP_CANHOLDROWS is ignored; the provider specifies its own limit.

See Also

Concepts

Working with OLE DB Provider Templates