Microsoft KB Archive/153282

= FIX: ClassWizard Overrides CDaoRecordset::Open Incorrectly =

Article ID: 153282

Article Last Modified on 10/17/2003

-

APPLIES TO

 The ClassWizard, when used with:  Microsoft Visual C++ 4.0 Standard Edition

 Microsoft Visual C++ 4.1 Subscription 

-



This article was previously published under Q153282



SYMPTOMS
If you override the CDaoRecordset::Open function using ClassWizard, the new function will never be called.



CAUSE
The Wizard places an UINT type for the first parameter rather than an int. The code should read:   virtual void Open(int ...) rather than: <pre class="fixed_text">  virtual void Open(UINT...)

<div class="resolution_section">

RESOLUTION
Change the type of the first parameter in your Open function from UINT to

int in the .h and .cpp files.

<div class="status_section">

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was corrected in Visual C++ version 4.2.

<div class="moreinformation_section">

Sample Code
The following sample code shows the correct function prototype for a CDaoRecordset-derived class named CMySet: // CMySet.H:  virtual void Open(int nOpenType = AFX_DAO_USE_DEFAULT_TYPE,           LPCTSTR lpszSql = NULL, int nOptions = 0); // CMySet.CPP: void CMySet::Open(int nOpenType, LPCTSTR lpszSql, int nOptions) {      // TODO: Add your specialized code here and/or call the base class CDaoRecordset::Open(nOpenType, lpszSql, nOptions); }

Additional query words: kbVC400bug

Keywords: kbbug kbfix kbvc420fix kbdatabase KB153282

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.