我现在应用ADO远程访问数据库,如果网络不通,ADO就会进行异常处理,对于异常处理,用户从客户端看不到的提示信息,我想在网络不通的情况下,继续连接数据库,直到连接上为止,该怎么办?

解决方案 »

  1.   

    我的源程序,你改改
    long DisplayAdoError()
    {
    CQsofficeApp* myapp=(CQsofficeApp*)AfxGetApp();
    long errorcount=myapp->m_pConnection->GetErrors ()->GetCount ();
    if (errorcount<1)
    return 1;
    _bstr_t add;
    CString errormsg;
    for (short i=0;i<errorcount;i++)
    {
    add=myapp->m_pConnection->GetErrors ()->GetItem (COleVariant((short)i))->GetDescription ();
    errormsg.Insert (0,(char*)add);
    errormsg+="\r";
    }
    #ifdef _DEBUG
    AfxMessageBox(errormsg);
    #endif
    myapp->m_pConnection ->GetErrors ()->Clear();
    return 1;
    }