请教下,用OLE DB接口操作数据库时,返回了一个错误码,如何知道他的具体错误信息。
我用了_com_error捕捉,结果他没有进catch里面。
然后,我又用CExpction,结果加所要用的文件头出来编译错误
原来工程编译没有问题的,我现在想用你这个异常类,加了个包含的头文件#include <afx.h>在stdafx.h里面,编译就出错了。楼上的知道如何解决吗
nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in Dll_MainEntry.obj
nafxcwd.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in Dll_MainEntry.obj; second definition ignored我移动了下位置,又变成了
fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>stdafx.h文件中头文件是这样的
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
#include <afx.h>
是不是还有个方法到MSDN上直接找,不用代码里面映射了。但是这个方法不知道怎么用。谁知道告诉我下,谢谢

解决方案 »

  1.   

    Debug->Exception->选中所有异常->确定,再调试。有异常就被 VC 抓到了。
      

  2.   

    试试:
    #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers#include <afxwin.h>         // MFC core and standard components
    不要直接包含:
    #include <windows.h>
    #include <afx.h>
    或者试试
    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>
      

  3.   

    楼上的,第一种会报错。第二种好像就是stdafx.h文件中的内容,也是不行的
      

  4.   

    如果不是mfc程序,不要用CException
      

  5.   

    关键是不用CEXcption,我不知道用什么来捕捉OLE DB错误了啊,_com__err捕捉不到的
      

  6.   

    VC6 也有设置,VC捕获异常的对话框,你得先运行起来,再看VC的菜单