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();
}
: 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();
}
: m_pAddplants(pAddplants)
或者用在CDialoG的时候把它当作参数传给构造函数,或者加一个什么SetDocument()什么的。
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();
}在实际使用的时候
使用真正的文档指针传入即可