TestADO.exe 遇到有关问题需要关闭。小弟我们对此引起的不便表示抱歉!可咋整啊

TestADO.exe 遇到问题需要关闭。我们对此引起的不便表示抱歉!!可咋整啊?
最近做一个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的时候都没有错误!!

是不是我的全局变量有问题,还是怎么回事那?请明示!

------解决方案--------------------

strSQL

有内容吗?如果有,内容正确吗?