Find the property group and property ID for the property you want. For more information, see
The following example assumes that you are trying to get a property from the rowset. The code for using the session or command is similar, but uses a different interface.
Create a
| В | Copy Code |
|---|---|
CDBPropSet propset(DBPROPSET_ROWSET); | |
Call
| В | Copy Code |
|---|---|
CDBPropSet propset(DBPROPSET_ROWSET); propset.AddProperty(DBPROP_IRowsetChange, true); propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_INSERT | DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_DELETE); | |
Use the IRowset interface to call GetProperties. Pass the property set as a parameter. Here is the final code:
| В | Copy Code |
|---|---|
CAgentRowset<CMyProviderCommand>* pRowset = (CAgentRowset<CMyProviderCommand>*) pThis;
CComQIPtr<IRowsetInfo, &IID_IRowsetInfo> spRowsetProps = pRowset;
DBPROPIDSET set;
set.AddPropertyID(DBPROP_BOOKMARKS);
DBPROPSET* pPropSet = NULL;
ULONG ulPropSet = 0;
HRESULT hr;
if (spRowsetProps)
hr = spRowsetProps->GetProperties(1, &set, &ulPropSet, &pPropSet);
if (pPropSet)
{
CComVariant var = pPropSet->rgProperties[0].vValue;
CoTaskMemFree(pPropSet->rgProperties);
CoTaskMemFree(pPropSet);
if (SUCCEEDED(hr) && (var.boolVal == VARIANT_TRUE))
{
... // Use property here
}
} | |
Dhtml editor
Free javascript download