Microsoft KB Archive/259379

= How To Develop with ADO Version 2.5 or Later and Install on ADO Version 2.0 =

Article ID: 259379

Article Last Modified on 7/1/2004

-

APPLIES TO


 * Microsoft ActiveX Data Objects 2.0
 * Microsoft ActiveX Data Objects 2.1
 * Microsoft ActiveX Data Objects 2.5
 * Microsoft ActiveX Data Objects 2.6
 * Microsoft ActiveX Data Objects 2.7

-



This article was previously published under Q259379



SUMMARY
Developers often have the latest software, while their customers may use an older version. Microsoft Windows 2000 comes with Microsoft Data Access Components (MDAC) version 2.5 installed. Developers who use Windows 2000 and who want to install their application on systems that are running versions of MDAC prior to version 2.5 cannot develop their application by using the latest Msado15.dll file.

On MDAC version 2.5 or later systems, Microsoft Visual Basic programmers who add a reference to Msado15.dll and Microsoft Visual C++ programmers who #import Msado15.dll, create images that will not run on systems that are running an earlier version of MDAC (for example MDAC version 2.1 GA). Any attempt to run an image that was developed on MDAC version 2.5 or later on a earlier-version system produces an error message similar to the following (for Visual Basic):

Run time error '430': Class does not support Automation or does not support expected interface

Visual C++ applications produce an an error message similar to the following:

Error 0x80004002 No such interface supported



MORE INFORMATION
These errors are caused by new ActiveX Data Objects (ADO) interfaces that are referenced in the ADO 2.5 or later-produced image and that are not found in the Msado15.dll file on the target system.

To prevent this problem, Visual Basic programmers should reference the Msado20.tlb file; Visual C++ programmers should #import Msado20.tlb. The Msado20.tlb type library file is in the ADO folder with Msado15.dll and ships with MDAC version 2.5 or later. If you use the version 2.0 type library, you won't have access to the newer interfaces (such as the Record object).

Visual C++ programmers may want to use the following preprocessor definition: #pragma message( &quot;Using ADO2 TLB&quot; ) #import  no_namespace rename(&quot;EOF&quot;, &quot;adoEOF&quot;) #pragma message( &quot;Using Latest ADO&quot; ) #import  no_namespace rename(&quot;EOF&quot;, &quot;adoEOF&quot;)
 * 1) if defined(ADO2_OLD)
 * 1) else
 * 1) endif

Another approach that you can use is to build a project once and use #import to generate the .tlh and .tli files, and then add the following to exactly one .cpp file: Also, add this code to a header file: When you use #import, if you have the .tlh or .tli files open in your Visual C++ project, the IDE frequently asks you if you would like to reload the .tlh or .tli file. If you #include the .tlh and .tli files, the IDE does not prompt you to reload these files.
 * 1) if defined(ADO2_TLH_I)
 * 2) pragma message( &quot;Using ADO2 TLI&quot; )
 * 3) include &quot;debug\msado20.tli&quot;
 * 4) endif
 * 1) if defined(ADO2_TLH_I)
 * 2) pragma message( &quot;Using ADO2 TLH&quot; )
 * 3) include &quot;debug\msado20.tlh&quot;
 * 4) endif

