CModiPlant::CModiPlant(CWnd* pParent /*=NULL*/)
: CDialog(CModiPlant::IDD, pParent)
{
//{{AFX_DATA_INIT(CModiPlant)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
   // CAppPlants *pAddplants; //文档类
     CString str;
    str="select * from Æ·ÖÖÐÅÏ¢±í";
    pAddplants->OpenTableset(str);   //在此处发生错误
    pAddplants->BoundingData();
   
    m_Datagrid.SetRefDataSource((LPUNKNOWN)pAddplants->pRs);
    m_Datagrid.Refresh();
}

解决方案 »

  1.   

    CAppPlants *pAddplants ;指针要进行初始化。
      

  2.   

    要想用外面的指针就在构造函数中传进来。CModiPlant(CAppPlants *pAddplants)
    : m_pAddplants(pAddplants)
      

  3.   

    你用全局变量好了,把你在外面创建的CDocument * pDoc ,在后面得到好了。
    或者用在CDialoG的时候把它当作参数传给构造函数,或者加一个什么SetDocument()什么的。
      

  4.   

    哈,问你一下阿,你是那个什么南开大学的warhorse 马?
      

  5.   

    头文件加上
      CModiPlant( CAppPlants *pAddplants,CWnd* pParent=NULL);实现文件中
      CModiPlant::CModiPlant(CAppPlants *pAddplants,CWnd* pParent /*=NULL*/)
    : CDialog(CModiPlant::IDD, pParent)
    {
         CString str;
         str="select * from Æ·ÖÖÐÅÏ¢±í";
         pAddplants->OpenTableset(str);   //在此处发生错误
         pAddplants->BoundingData();
       
         m_Datagrid.SetRefDataSource((LPUNKNOWN)pAddplants->pRs);
         m_Datagrid.Refresh();
    }在实际使用的时候
    使用真正的文档指针传入即可