共用方式為


CDynamicAccessor::GetValue

擷取指定資料行的資料。

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

參數

  • ctype
    [in]樣板化的參數來處理字串型別以外的任何資料型別 (CHAR 1WCHAR 1),這需要特別處理。 GetValue使用適當的資料類型,根據您所指定以下。

  • nColumn
    [in]資料行數目。 資料行編號從 1 開始。 值為 0 參照到書籤資料行中,如果有的話。

  • pColumnName
    [in]資料行名稱。

  • pData
    [] out滑鼠指標以指定的資料行的內容。

傳回值

如果您想要傳遞字串資料,使用非樣板版本的GetValue。 這個方法的非樣板版本都會傳回 void 1,其中的一部份,其中包含指定的資料行資料的緩衝區所指向的點。 傳回 NULL 如果找不到資料行。

對於其他資料型別時,會更容易使用的樣板化版本GetValue。 樣板化版本都會傳回 ,則為 true 成功或 ,則為 false 錯誤所致。

備註

傳回包含字串和樣板化的版本,而包含其他資料類型的資料行的資料行中使用非樣板的版本。

在偵錯模式,就會看到一個判斷提示如果大小的pData是不相等,它所指向的資料行的大小。

需求

標頭: atldbcli.h

請參閱

參考

CDynamicAccessor 類別