新手请教ado调用的问题。
我用基本对话框创建了一个mfc工程,并想调用ado进行数据库操作在打星号处加了智能指针定义出了以下错误为什么啊。
class CTestDlg : public CDialog
{
// Construction
public:
CTestDlg(CWnd* pParent = NULL);// standard constructor
// Dialog Data
//{{AFX_DATA(CTestDlg)
enum { IDD = IDD_TEST_DIALOG };
**** _ConnectionPtr m_pConnection;
**** _RecordsetPtr m_pRecordset;
**** ClistCtrl m_List;
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTestDlg)
error C2146: syntax error : missing '; ' before identifier 'm_pConnection '
: error C2501: '_ConnectionPtr ' : missing storage-class or type specifiers
: error C2501: 'm_pConnection ' : missing storage-class or type specifiers
: error C2146: syntax error : missing '; ' before identifier 'm_pRecordset '
: error C2501: '_RecordsetPtr ' : missing storage-class or type specifiers
: error C2501: 'm_pRecordset ' : missing storage-class or type specifiers
: error C2018: unknown character '0xa1 '
: error C2018: unknown character '0xa1 '
error C2146: syntax error : missing '; ' before identifier 'm_List '
error C2501: 'ClistCtrl ' : missing storage-class or type specifierse:
error C2501: 'm_List ' : missing storage-class or type specifiers
[解决办法]
fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
按字面意思做就可以了.
说MFC APPS must not #include <windows.h>
把你App里面#include <windows.h> 去掉
[解决办法]
导入ADO后,把stdAfx.h文件里面关于数据库的包函函数通通去掉,你一定在创建工程的时候选择了支持数据库,下次不要选择了!