x64 ADO connection fails with 0x80004005

  64-bit, ado, c++, x86

I have a simple piece of code written in C++ (Visual Studio Professional 2019) to open a (32-bit) access database :

    #import "c:Program FilesCommon FilesSystemADOmsado15.dll" 
       no_namespace rename("EOF", "EndOfFile")
        
    try
    {
        // open connection
        m_pConnectionPtr.CreateInstance(__uuidof(Connection));
        bstr_t strCnn("Driver={Microsoft Access Driver (*.mdb)};Dbq=d:MyDatabase.mdb;User ID=sa;");
        m_pConnectionPtrReceptuur->Open(strCnn, "", "", NULL);
    }
    catch (_com_error& e)
    {
      // do something
    }

This works fine when compiling x86.
When setting my environment to x64 I enter the catch with error 0x80004005 which means ‘unspecified error’.
Do I have to convert my access database to 64 bit or am I missing something else?

Thanks for any suggestions!

Source: Windows Questions C++

LEAVE A COMMENT