请教了

woaini5994 2003-10-19 01:51:23
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;
...全文
35 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
spwnihao 2003-10-20
  • 打赏
  • 举报
回复
GetInterfacePtr()
把这个去掉
spwnihao 2003-10-20
  • 打赏
  • 举报
回复
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 adOpenDynamic,
adLockOptimistic,
adCmdText);


return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

4,011

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 数据库
社区管理员
  • 数据库
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧