CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Location
    UK
    Posts
    59

    The ADO Open() call.

    I'm developing a database app using ADO. Everything is fine, however I want to implement a retry system which is used when the Open() call fails due to the database already being opened with the shareExclusive flag set. Open() throws a _com_error, but I can't find any indication of the reason for the exception (the HRESULT of this structure is E_FAIL, which is defined as an unspecified error). Does anyone know how to detect that this call has failed due to file locking?

    Cheers

    MJA

  2. #2
    Join Date
    May 1999
    Location
    St-Petersburg (Russia)
    Posts
    32

    Re: The ADO Open() call.

    Have you tried e.Error()? (_com_error &e) or
    e.WCodeToHRESULT( e.WCode() )?

    I use this to find out a description of the error:


    TCHAR szSource[255];
    TCHAR szDescription[255];

    _bstr_t bstrSource(e.Source());
    _bstr_t bstrDescription(e.Description());

    WideCharToMultiByte( CP_ACP, 0, bstrSource, 255, szSource, 255, 0, 0 );
    WideCharToMultiByte( CP_ACP, 0, bstrDescription, 255, szDescription, 255, 0, 0 );








Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured