Metodo IModelKeyReference2::GetKeyName (dbgmodel.h)

Il metodo GetKeyName restituisce il nome della chiave a cui fa riferimento questa chiave. La stringa restituita è una BSTR standard e deve essere liberata tramite una chiamata a SysFreeString.

Sintassi

HRESULT GetKeyName(
  BSTR *keyName
);

Parametri

keyName

Il nome della chiave a cui viene fatto riferimento a questa chiave verrà restituito qui come stringa allocata.

Valore restituito

Questo metodo restituisce HRESULT che indica l'esito positivo o l'errore.

Commenti

Codice di esempio

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);
    }
}

Requisiti

Requisito Valore
Intestazione dbgmodel.h

Vedi anche

Interfaccia IModelKeyReference2