本帖最后由 sunhaooo 于 2013-08-22 15:34:13 编辑

解决方案 »

  1.   

    select * from student在SQLSERVER查询分析器中能正确执行吗?
    没做过WINCE的程序,不知道能捕获异常不?
    //打印调用ADO控件时产生的详细错误信息
    void dump_com_error(_com_error &e)
    {
    CString ErrorStr;
    _bstr_t bstrSource(e.Source());
    _bstr_t bstrDescription(e.Description());
    ErrorStr.Format( "\n\tADO Error\n\tCode = %08lx\n\tCode meaning = %s\n\tSource = %s\n\tDescription = %s\n\n",
    e.Error(), e.ErrorMessage(), (LPCTSTR)bstrSource, (LPCTSTR)bstrDescription );
    //在调试窗口中打印错误信息,在Release版中可用DBGView查看错误信息
    ::OutputDebugString((LPCTSTR)ErrorStr);
    #ifdef _DEBUG
    AfxMessageBox(ErrorStr, MB_OK | MB_ICONERROR);
    #endif
    }try
    {
    //你的ADO代码
            
    }
    catch(_com_error& e)
    {
    dump_com_error(e);