::CoInitialize(NULL);
_ConnectionPtr pcom;
_RecordsetPtr  pRs;
pcom.CreateInstance(_uuidof(Connection));
pcom->Open("DNS=TestDataBase","","",NULL);
pRs.CreateInstance(_uuidof(Recordset));
pRs->Open("selete *from PersonInfor",
                     pcom.GetInterfacePtr(),
                     adOpenDynamic,
                     adLockOptimistic,
   adCmdText);
pRs->Close();
pcom->Close();
::CoUninitialize();
我一运行以上的代码,就弹出一个(Microsoft C++ Runtime Libarary )对话框
Runtime error
This is application has request the runtime to terminate it in a unusually way. pleaset contact the application's support team for more information
!!!!!!!!!!!
是不是我的编译器的参数设置错了,还是哪里

解决方案 »

  1.   

    用try...catch把异常抓出来看看
      

  2.   

    推荐使用try catch捕捉异常.
      

  3.   

    捕捉不到异常的
    我用CDatabase 和CRecordset两个类,实现的如下时
    CDatabase db;
    db.Open("TestDataBase");
    CRecordset rs(&db);
    if(rs.IsOpen())
    rs.Close();
    rs.Open(CRecordset::snapshot);///////////在这个地方也出错了。当我从CRcordset继承一个类CRecordDB时  如下的代码,却没有什么问题,我想搞清楚我以上的问题出在哪里
             CDatabase db;
    db.Open("TestDataBase");
    CRecordsetDB  rs(&db);////////CRecordsetDB 非CRecordset
    if(rs.IsOpen())
    rs.Close();
    rs.Open(CRecordset::snapshot);