Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Assertion error on UpdateData(True) Command

Posted on 1998-05-24
2
Medium Priority
?
1,218 Views
Last Modified: 2013-11-20
Hello All

Whilst running my application, I am getting the following error, when the program try's to execute the command "UpdateData(True)"

"Debug Assertion Failed!
Program C:\Applications\test40.exe
File dlgdata.cpp
Line 565

The message box gives the options to: Abort, retry and Ignore.  When you retry or ignore the program crashes.

On pressing the retry button, the debugger points to the first ASSERT statement below.

void AFXAPI DDX_Control(CDataExchange* pDX, int nIDC, CWnd& rControl)
{
      if (rControl.m_hWnd == NULL)    // not subclassed yet
      {
            ASSERT(!pDX->m_bSaveAndValidate);

            HWND hWndCtrl = pDX->PrepareCtrl(nIDC);

            if (!rControl.SubclassWindow(hWndCtrl))
            {
                  ASSERT(FALSE);      // possibly trying to subclass twice?
                  AfxThrowNotSupportedException();
            }
#ifndef _AFX_NO_OCC_SUPPORT
            else
            {
                  // If the control has reparented itself (e.g., invisible control),
                  // make sure that the CWnd gets properly wired to its control site.
                  if (pDX->m_pDlgWnd->m_hWnd != ::GetParent(rControl.m_hWnd))
                        rControl.AttachControlSite(pDX->m_pDlgWnd);
            }
#endif //!_AFX_NO_OCC_SUPPORT

      }
}

I checked to make sure that the :DoDataExchange function is not refering to any control which does is not present in the dialog.

After tracing though the code, the assertion error occurs on the first line of the code in the DoDataExchange function, i.e

DDX_Control(pDX, IDC_BTNSPECIALOFFERS, m_ctlBtnSpecialOffers);

However it appears to work on DDX_Text macros.  I have also tried: m_bSaveAndValidate = True, but still this does not make any difference.

This application works fine under Visual C++ 2.0 using ODBC, but I am experiencing the above problem when converting the application to Visual C++ 4.0 using DAO.

Is anyone aware of the possible cause of this error.  I have double checked the DoDataExchange() function and there appears to be nothing wrong with it.

I very much look forward to any suggestions of the possible cause of this error.  Please reply by e-mail: AsifMughal@aol.com

Best Regards

Asif
0
Comment
Question by:AsifMughal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 3

Accepted Solution

by:
tma050898 earned 400 total points
ID: 1314649
Where are you calling UpdateData(TRUE) from???

Are you using dialogs or views?

If you are using dialogs, did you call the base class' OnInitDialog. Is your call to UpdateData(TRUE) before that call?

If you are using views, did you call the base class' OnInitialUpdate? Is your call to UpdateData(TRUE) before that call?

This sounds like you aren't getting subclassed before you are callign UpdateData(TRUE). The base class initialization routines (OnInitialUpdate for views and OnInitDialog for dialogs) calls UpdateData(FALSE). If you removed that or if you placed your call to UpdateData(TRUE) before that, this is your problem.

Tom
0
 
LVL 3

Expert Comment

by:tma050898
ID: 1314650
Could you post your OnInitDialog or OnInitialUpdate???
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question