Microsoft KB Archive/190726

= FIX: Visual C++ 5.0 #import Causes Errors with ADO Version 2.0 =

Article ID: 190726

Article Last Modified on 11/18/2003

-

APPLIES TO


 * Microsoft Visual C++ 5.0 Enterprise Edition
 * Microsoft Visual C++ 5.0 Professional Edition
 * Microsoft ActiveX Data Objects 2.0

-



This article was previously published under Q190726



SYMPTOMS
On a clean Windows 95 or Windows 98 machine with DCOM95 or DCOM98 installed, compile the following in a .cpp file: RESULT: You get the following error messages:
 * 1) import "c:\program files\common files\system\ado\msado15.dll"

  error C2504: '_Connection15' : base class undefined

  error C2504: '_Recordset15' : base class undefined

  error C2504: 'Fields15' : base class undefined

  error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Connection *const ' to 'struct IUnknown *'

  error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Recordset *const ' to 'struct IUnknown *'

  error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Recordset *const ' to 'struct IUnknown *'

  error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Recordset *const ' to 'struct IUnknown *'

  error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Recordset *const ' to 'struct IUnknown *'

  error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Recordset *const ' to 'struct IUnknown *'

  error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Recordset *const ' to 'struct IUnknown *'

  error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Recordset *const ' to 'struct IUnknown *'

  error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Recordset *const ' to 'struct IUnknown *'

  error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Recordset *const ' to 'struct IUnknown *'

  error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Recordset *const ' to 'struct IUnknown *'

<pre class="fixed_text">  error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Recordset *const ' to 'struct IUnknown *'

<pre class="fixed_text">  error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Recordset *const ' to 'struct IUnknown *'

<pre class="fixed_text">  error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Recordset *const ' to 'struct IUnknown *'

<pre class="fixed_text">  error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::Fields *const ' to 'struct IUnknown *'

<pre class="fixed_text">  error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::Fields *const ' to 'struct IUnknown *'

NOTE: This problem also occurs on Windows NT 4.0, and the resolution given applies.

<div class="cause_section">

CAUSE
This is a problem in the #import feature of the compiler.

<div class="resolution_section">

RESOLUTION
To work around this problem, use one of the following alternatives:

<ul> <li>Install Visual Studio 97, Service Pack 3.</li> <li>Upgrade to Visual C++, version 6.0.</li> <li>Modify the resultant .tlh file by moving each of the declarations for

_Connection15, _Recordset15, and Field15

ahead of each of the declarations for

Connection, Recordset, and Field.

</li></ul>

<div class="status_section">

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. The problem has been corrected in Visual Studio 97, Service Pack 3, and also in Visual C++ version 6.0.

<div class="references_section">