m_stempSql = m_rSheet->m_rgODBCFieldInfos[i].m_strName; //m_rSheet 为CRecordset类实例
上面的程序正确通过编译,功能是用CRecordset来读取EXCEL表。
这是个在网上找到的一个工程中的程序,我找遍整个CSDN,也找不到CRecordset类有个m_rgODBCFieldInfos成员,CRecordset类也不是自定义类,而是大家常见的记录集类,经常和CDatabase一起使用的那个。
2 个解决方案
#1
public:
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif //_DEBUG
virtual BOOL Check(RETCODE nRetCode) const; // general error check
void InitRecord();
void ResetCursor();
void CheckRowsetCurrencyStatus(UWORD wFetchType, long nRows);
RETCODE FetchData(UWORD wFetchType, SDWORD nRow,
DWORD* pdwRowsFetched);
void SkipDeletedRecords(UWORD wFetchType, long nRows,
DWORD* pdwRowsFetched, RETCODE* pnRetCode);
virtual void SetRowsetCurrencyStatus(RETCODE nRetCode,
UWORD wFetchType, long nRows, DWORD dwRowsFetched);
virtual void PreBindFields(); // called before data fields are bound
UINT m_nFields; // number of RFX fields
UINT m_nParams; // number of RFX params
BOOL m_bCheckCacheForDirtyFields; // switch for dirty field checking
BOOL m_bRebindParams; // date or UNICODE text parameter existence flag
BOOL m_bLongBinaryColumns; // long binary column existence flag
BOOL m_bUseUpdateSQL; // uses SQL-based updates
DWORD m_dwOptions; // archive dwOptions on Open
SWORD m_nResultCols; // number of columns in result set
BOOL m_bUseODBCCursorLib; // uses ODBC cursor lib if m_pDatabase not Open
CODBCFieldInfo* m_rgODBCFieldInfos; // Array of field info structs with ODBC meta-data
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif //_DEBUG
virtual BOOL Check(RETCODE nRetCode) const; // general error check
void InitRecord();
void ResetCursor();
void CheckRowsetCurrencyStatus(UWORD wFetchType, long nRows);
RETCODE FetchData(UWORD wFetchType, SDWORD nRow,
DWORD* pdwRowsFetched);
void SkipDeletedRecords(UWORD wFetchType, long nRows,
DWORD* pdwRowsFetched, RETCODE* pnRetCode);
virtual void SetRowsetCurrencyStatus(RETCODE nRetCode,
UWORD wFetchType, long nRows, DWORD dwRowsFetched);
virtual void PreBindFields(); // called before data fields are bound
UINT m_nFields; // number of RFX fields
UINT m_nParams; // number of RFX params
BOOL m_bCheckCacheForDirtyFields; // switch for dirty field checking
BOOL m_bRebindParams; // date or UNICODE text parameter existence flag
BOOL m_bLongBinaryColumns; // long binary column existence flag
BOOL m_bUseUpdateSQL; // uses SQL-based updates
DWORD m_dwOptions; // archive dwOptions on Open
SWORD m_nResultCols; // number of columns in result set
BOOL m_bUseODBCCursorLib; // uses ODBC cursor lib if m_pDatabase not Open
CODBCFieldInfo* m_rgODBCFieldInfos; // Array of field info structs with ODBC meta-data
#2
看最后一行就明白了,是从MFC源码中找到的
#1
public:
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif //_DEBUG
virtual BOOL Check(RETCODE nRetCode) const; // general error check
void InitRecord();
void ResetCursor();
void CheckRowsetCurrencyStatus(UWORD wFetchType, long nRows);
RETCODE FetchData(UWORD wFetchType, SDWORD nRow,
DWORD* pdwRowsFetched);
void SkipDeletedRecords(UWORD wFetchType, long nRows,
DWORD* pdwRowsFetched, RETCODE* pnRetCode);
virtual void SetRowsetCurrencyStatus(RETCODE nRetCode,
UWORD wFetchType, long nRows, DWORD dwRowsFetched);
virtual void PreBindFields(); // called before data fields are bound
UINT m_nFields; // number of RFX fields
UINT m_nParams; // number of RFX params
BOOL m_bCheckCacheForDirtyFields; // switch for dirty field checking
BOOL m_bRebindParams; // date or UNICODE text parameter existence flag
BOOL m_bLongBinaryColumns; // long binary column existence flag
BOOL m_bUseUpdateSQL; // uses SQL-based updates
DWORD m_dwOptions; // archive dwOptions on Open
SWORD m_nResultCols; // number of columns in result set
BOOL m_bUseODBCCursorLib; // uses ODBC cursor lib if m_pDatabase not Open
CODBCFieldInfo* m_rgODBCFieldInfos; // Array of field info structs with ODBC meta-data
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif //_DEBUG
virtual BOOL Check(RETCODE nRetCode) const; // general error check
void InitRecord();
void ResetCursor();
void CheckRowsetCurrencyStatus(UWORD wFetchType, long nRows);
RETCODE FetchData(UWORD wFetchType, SDWORD nRow,
DWORD* pdwRowsFetched);
void SkipDeletedRecords(UWORD wFetchType, long nRows,
DWORD* pdwRowsFetched, RETCODE* pnRetCode);
virtual void SetRowsetCurrencyStatus(RETCODE nRetCode,
UWORD wFetchType, long nRows, DWORD dwRowsFetched);
virtual void PreBindFields(); // called before data fields are bound
UINT m_nFields; // number of RFX fields
UINT m_nParams; // number of RFX params
BOOL m_bCheckCacheForDirtyFields; // switch for dirty field checking
BOOL m_bRebindParams; // date or UNICODE text parameter existence flag
BOOL m_bLongBinaryColumns; // long binary column existence flag
BOOL m_bUseUpdateSQL; // uses SQL-based updates
DWORD m_dwOptions; // archive dwOptions on Open
SWORD m_nResultCols; // number of columns in result set
BOOL m_bUseODBCCursorLib; // uses ODBC cursor lib if m_pDatabase not Open
CODBCFieldInfo* m_rgODBCFieldInfos; // Array of field info structs with ODBC meta-data
#2
看最后一行就明白了,是从MFC源码中找到的