IEnumCERTVIEWCOLUMN::Next

[This is preliminary documentation and subject to change.]

The Next method positions the IEnumCERTVIEWCOLUMN object to the next column.

[VB] Long Next();
 
[JAVA] int Next();
 
[C++] HRESULT Next(
  LONG *pIndex  // out
);
 

Parameters

[C++] pIndex
Pointer to variable that will contain the index value of the next column referenced by the IEnumCERTVIEWCOLUMN object. If there are no more columns to enumerate, this variable will be set to – 1. This function will fail if pIndex is NULL.

Return Values

[VB][JAVA] The return value is the index value of the next column that will be referenced by the IEnumCERTVIEWCOLUMN object. If there are no more rows to enumerate, the return value will be – 1.

[C++] The return value is an HRESULT. A value of S_OK indicates success and that the next column is now being referenced by the IEnumCERTVIEWCOLUMN object. If there are no more columns to enumerate, S_FALSE is returned, and pIndex will point to a value of – 1.

Remarks

Upon successful completion of this function, the Certificate Server view's IEnumCERTVIEWCOLUMN object will be referencing the next column. When the IEnumCERTVIEWCOLUMN is referencing a column, the column information can be retrieved through the IEnumCERTVIEWCOLUMN methods GetName, GetType, and GetValue.

Example

LONG       nLength;
LONG       nType;
LONG       bIsindexed;
LONG       Index;

HRESULT    hr;

BSTR       bstrColName = NULL;

// pEnumCol is previously instantiated IEnumCERTVIEWColumn object
// examine each column
while ( S_FALSE != pEnumCol->Next( &Index ) )
{
    // determine database length
    hr = pEnumCol->GetMaxLength( &nLength );
    if ( FAILED( hr ) )
    {
        printf("Failed GetMaxLength %x\n", hr);
        goto error;
    }

    // determine data type
    hr = pEnumCol->GetType( &nType );
    if ( FAILED( hr ) )
    {
        printf("Failed GetType %x\n", hr);
        goto error;
    }

    // determine if column is indexed
    hr = pEnumCol->IsIndexed( &bIsindexed );
    if ( FAILED( hr ) )
    {
        printf("Failed IsIndexed %x\n", hr);
        goto error;
    }

    // retrieve column name
    hr = pEnumCol->GetName( &bstrColName );
    if ( FAILED( hr ) )
    {
        printf("Failed GetName %x\n", hr);
        goto error;
    }

    // print this column's info on one line
    // print name and length
    printf("Column %S has max length %d",
            bstrColName,
            nLength ); 

    // print data type
    switch ( nType )
    {
        case PROPTYPE_BINARY:
            printf(" Type is Binary");
            break;
        case PROPTYPE_DATE:
            printf(" Type is Date+Time");
            break;
        case PROPTYPE_LONG:
            printf(" Type is Signed long");
            break;
        case PROPTYPE_STRING:
            printf(" Type is Unicode String");
            break;
        default:
            printf(" Type is unknown");
            break;
    }

    // print index status
    printf( bIsindexed ? " Indexed" : " Not indexed");
    // print new line marker
    printf("\n");

}

error:

// done processing, clear resources
if ( NULL != bstrColName )
    SysFreeString( bstrColName );
 

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in certview.h.
  Import Library: Use certidl.lib.

See Also

IEnumCERTVIEWCOLUMN::GetName, IEnumCERTVIEWCOLUMN::GetType, IEnumCERTVIEWCOLUMN::GetValue