error c2065错误代码

我在头文件中定义了m_pConnection。但是在后面调用时候还是会弹出错误
1 error C2065: “m_pConnection”: 未声明的标识符
代码
class CstudentDlg : public CDialog
{
// 构造
public:
_ConnectionPtr m_pConnection;
_RecordsetPtr m_pRecordset;
_CommandPtr m_pCommand;

错误位置
// TODO: 在此处添加消息处理程序代码

if (m_pConnection)
m_pConnection->Close();        // 关闭连接

}

出现“1 error C2065: “m_pConnection”: 未声明的标识符”错误时,访问m_pConnection的代码是在哪儿?是在CstudentDlg class成员函数,还是第三方函数?
m_pConnection是CstudentDlg 的member data,只能在其member function中访问的;class外无法直接访问。