Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The Next method moves to the next column in the column-enumeration sequence.
Syntax
HRESULT Next(
  [out] LONG *pIndex
);
Parameters
[out] pIndex
A pointer to a variable that contains the index value of the next column referenced by the column-enumeration sequence. If there are no more columns to enumerate, this variable is set to –1. This method will fail if pIndex is NULL.
Return value
C++
If the method succeeds, the method returns S_OK and the next column in the column-enumeration sequence is now being referenced. If there are no more columns to enumerate, the method returns S_FALSE, and the pIndex parameter is set to a value of –1.If the method fails, it returns an HRESULT value that indicates the error. For a list of common error codes, see Common HRESULT Values.
VB
The return value is the index value of the column that is now referenced by the column-enumeration sequence. If there are no more columns to enumerate, the return value is –1.Remarks
Upon successful completion of this method, the information in the column can be obtained by calling one of the following methods:
- IEnumCERTVIEWCOLUMN::GetName: Retrieves the nonlocalized name of the column.
 - IEnumCERTVIEWCOLUMN::GetDisplayName: Retrieves the localized name of the column.
 - IEnumCERTVIEWCOLUMN::GetValue: Retrieves the data in the column.
 - IEnumCERTVIEWCOLUMN::GetType: Retrieves the type of data in the column.
 - IEnumCERTVIEWCOLUMN::GetMaxLength: Retrieves the maximum length, in bytes, of the column.
 
Examples
LONG       nLength;
LONG       nType;
LONG       bIsindexed;
LONG       Index;
HRESULT    hr;
BSTR       bstrColName = NULL;
// pEnumCol is previously instantiated IEnumCERTVIEWCOLUMN object
// examine each column
while (S_OK == 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 whether 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 %ws 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);
Requirements
| Requirement | Value | 
|---|---|
| Minimum supported client | None supported | 
| Minimum supported server | Windows Server 2003 [desktop apps only] | 
| Target Platform | Windows | 
| Header | certview.h (include Certsrv.h) | 
| Library | Certidl.lib | 
| DLL | Certadm.dll | 
See also
IEnumCERTVIEWCOLUMN::GetDisplayName