最近做一个VC数据库程序!在StdAfx.h中定义两个全局变量:static _RecordsetPtr m_pRecordset;
static _ConnectionPtr m_pConnection;在TestADODlg.cpp文件中
连接数据库,然后
m_pRecordset->Close();在另外一个QueryDlg.cpp文件中用同样的方法得到结果集
m_pRecordset->Open((_bstr_t)strSQL,// query all the fields of usertable
_variant_t((IDispatch *)m_pConnection, true),
adOpenDynamic, adLockOptimistic, adCmdText);就说运行时候出错,但是在编译和build的时候都没有错误!!是不是我的全局变量有问题,还是怎么回事那?请明示!