Can I retrieve column names using MFC classes
-
I am developing a MFC-based program (using CRecordset and CDatabase) dealt with MS Access. I want to retrieve the column names of a table. Could I do that without using ODBC APIs?
-
I am developing a MFC-based program (using CRecordset and CDatabase) dealt with MS Access. I want to retrieve the column names of a table. Could I do that without using ODBC APIs?
-
I am developing a MFC-based program (using CRecordset and CDatabase) dealt with MS Access. I want to retrieve the column names of a table. Could I do that without using ODBC APIs?
You can use member GetODBCFieldInfo of CRecordset: void GetODBCFieldInfo( short nIndex, CODBCFieldInfo& fieldinfo ); // Definition of CODBCFieldInfo struct CODBCFieldInfo { CString m_strName; //thats what you want SWORD m_nSQLType; UDWORD m_nPrecision; SWORD m_nScale; SWORD m_nNullability; };
-
You can use member GetODBCFieldInfo of CRecordset: void GetODBCFieldInfo( short nIndex, CODBCFieldInfo& fieldinfo ); // Definition of CODBCFieldInfo struct CODBCFieldInfo { CString m_strName; //thats what you want SWORD m_nSQLType; UDWORD m_nPrecision; SWORD m_nScale; SWORD m_nNullability; };
Sorry,I found that I hadn't expressed myself clearly. What I want to know is all the column names of the table, not only the names in the recordset.
-
Sorry,I found that I hadn't expressed myself clearly. What I want to know is all the column names of the table, not only the names in the recordset.