#pragma warning(push) // Needs to be done in order to suppress warning message #pragma warning(disable:4146) // caused by bug in ADO (MS Knowledge Base article Q253317) #import "C:Program FilesCommon Filessystemadomsado15.dll" no_namespace rename("EOF","adoEOF") #pragma warning(pop)
> The call to CreateInstance will fail when the code is > compiled with a MDAC 2.7 version of msado.dll but run on > a system with MDAC 2.5 installed. It returns a HRESULT of > 0x80004002 (E_NOINTERFACE) - "The QueryInterface method > did not recognize the requested interface. The interface > is not supported.". i.e. the code tried to find the new > _Command interface NOT the old _Command interface as > defined in MDAC 2.5. > The code works fine when compiled with MDAC 2.5 and run > on a system with MDAC 2.5 or greater. (Will also work > fine when compiled with MDAC 2.7 and run on MDAC 2.7). > > SOLUTIONS > ------------------ > > 1) Compile only on MDAC 2.5 and then can target MDAC 2.5 > or greater (Not really an option with Windows XP (.NET > etc.)) > > 2) Compile with MDAC 2.7 and force all clients to upgrade > to MDAC 2.7 (Not an ideal solution as already have enough > problems when forcing clients to install MDAC 2.5 - > breaking existing apps - or simply not installing > properly as part of the install process) > > 3) The solution we have come up with is to develop on > systems with MDAC 2.7 installed but not to use > the "_Command" interface. Instead we use the "Command25" > interface (i.e. this is the renamed "_Command" interface > from MDAC 2.5). This means all our developers are forced > to develop on MDAC 2.7 but we can continue to target MDAC > 2.5 or better). i.e. the above code becomes > > ADODB::Command25Ptr pCmdChange = NULL; > HRESULT hResult = pCmdChange.CreateInstance > (__uuidof(ADODB::Command));