CPropertySheet m_other_infor;//对话框的头文件中定义
希望可以通过他,实现属性页,是实现了,
m_other_infor.AddPage(&m_course);
m_other_infor.AddPage(&m_select);
m_other_infor.AddPage(&m_dorm);//初始化函数中中实现的
oid CMainDlg::OnOtherInformation() 
{
// TODO: Add your command handler code here
if(m_other_infor.DoModal()==IDOK)
{        MessageBox("this is propertypage ok"); }
}//调用也成功,但是在每一个页面中希望,可以操作数据库
//_RecordsetPtr m_pRecordset;//在相应的页面的头文件中已经定义
在初始化的函数中添加的下面代码
m_pRecordset->Open("SELECT * FROM course",                // 查询DemoTable表中所有字段
theApp.m_pConnection.GetInterfacePtr(),  // 获取库接库的IDispatch指针
adOpenDynamic,
adLockOptimistic,
adCmdText);
但是加完代码之后就无法在打开属性页,的对话框了,请有经验的朋友
帮忙,感激不尽。

解决方案 »

  1.   

    你可以把程序发给我我帮你看一下[email protected]
      

  2.   

    你的程序中没有初始化类的成员m_pRecordset,在打开的时候m_pRecordset还是NULL
      

  3.   

    BOOL CCoursePage::OnInitDialog() 
    {
    CPropertyPage::OnInitDialog();
    DWORD dwStyle;
    dwStyle= LVS_EX_GRIDLINES |LVS_EX_FULLROWSELECT|LVS_SHOWSELALWAYS ;
    m_course_list.SetExtendedStyle(dwStyle);
    // TODO: Add extra initialization here
    m_course_list.InsertColumn(0,"序号",LVCFMT_LEFT,60);
    m_course_list.InsertColumn(1,"课程号",LVCFMT_LEFT,60);
    m_course_list.InsertColumn(2,"课程名",LVCFMT_LEFT,60);
    m_pRecordset.CreateInstance(__uuidof(Recordset));
    m_pRecordset->Open("SELECT * FROM course",                // 查询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
    }
      

  4.   

    bluebohe(薄荷) 
    这个人好尽职哦