请教了
BOOL CMainDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_pRecordset.CreateInstance(__uuidof(Recordset));
m_pRecordset->Open("SELECT * FROM base_table", // 查询DemoTable表中所有字段
theApp.m_pConnection.GetInterfacePtr(),//如果在一个对话框的初始化的函数中这样做,还不允许不知道为什么? // 获取库接库的IDispatch指针
adOpenDynamic,
adLockOptimistic,
adCmdText);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
F:\我的毕业作品\myproject\MainDlg.cpp(66) : error C2228: left of '.m_pConnection' must have class/struct/union type
F:\我的毕业作品\myproject\MainDlg.cpp(66) : error C2228: left of '.GetInterfacePtr' must have class/struct/union type
这里我已经在前面声明了
extern theApp, 而且在应用程序的 XXXAPP的类中定义了,_ConnectionPtr m_pConnection;