Freigeben über


CDynamicAccessor::GetValue

Retrieves the data for a specified column.

void* GetValue( 
   DBORDINAL nColumn  
) const throw( );
void* GetValue(
   const CHAR* pColumnName 
) const throw( );
void* GetValue(
   const WCHAR* pColumnName 
) const throw( );
template < class ctype >
bool GetValue(
   DBORDINAL nColumn,
   ctype* pData 
) const throw( );
template < class ctype >
bool GetValue(
   const CHAR* pColumnName,
   ctype* pData 
) const throw( );
template < class ctype >
bool GetValue(
   const WCHAR* pColumnName,
   ctype* pData 
) const throw( );

Parameters

  • ctype
    [in] A templated parameter that handles any data type except string types (CHAR*, WCHAR*), which require special handling. GetValue uses the appropriate data type based on what you specify here.

  • nColumn
    [in] The column number. Column numbers start with 1. A value of 0 refers to the bookmark column, if any.

  • pColumnName
    [in] The column name.

  • pData
    [out] The pointer to the contents of the specified column.

Return Value

If you want to pass string data, use the nontemplated versions of GetValue. The nontemplated versions of this method return void*, which points to the part of the buffer that contains the specified column data. Returns NULL if the column is not found.

For all other data types, it is simpler to use the templated versions of GetValue. The templated versions return true on success or false on failure.

Remarks

Use the nontemplated versions to return columns that contain strings and the templated versions for columns that contain other data types.

In debug mode, you will get an assertion if the size of pData is unequal to the size of the column to which it points.

Requirements

Header: atldbcli.h

See Also

Reference

CDynamicAccessor Class

Other Resources

CDynamicAccessor Members