IModelKeyReference::GetKeyName method (dbgmodel.h)
The GetKeyName method returns the name of the key to which this key reference is a handle. The returned string is a standard BSTR and must be freed via a call to SysFreeString.
Syntax
HRESULT GetKeyName(
BSTR *keyName
);
Parameters
keyName
The name of the key to which this key reference is a handle will be returned here as an allocated string.
Return value
This method returns HRESULT that indicates success or failure.
Remarks
Code Sample
ComPtr<IModelObject> spObject; /* get an object */
ComPtr<IModelKeyReference> spKeyRef;
if (SUCCEEDED(spObject->GetKeyReference(L"Id", &spKeyRef, nullptr)))
{
// The key reference is a reference to the Id key. The name returned
// should be "Id"
BSTR returnedKeyName;
if (SUCCEEDED(spKeyRef->Getname(&returnedKeyName)))
{
// returnedKeyName is "Id"
SysFreeString(returnedKeyName);
}
}
Requirements
Requirement | Value |
---|---|
Header | dbgmodel.h |