Jump to content
  • Advertisement
Sign in to follow this  

Visual C++ in 21 Days: ODBC trouble.

This topic is 3984 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys/gals I need your help once more.  Under the guidance of “Sams Teach Yourself Visual C++ 6 in 21 Days” I’m trying to learn Visual C++ but I’ve run into some problems with Day 14: Retrieving data from an ODBC Database, everything works fine until it’s it time for DDX_FieldText to convert a COleDateTime variable. The book solves this by doing it more or less manually

1: void CDbOdbcView::DoDataExchange(CDataExchange* pDX)
2: {
3: CRecordView::DoDataExchange(pDX);
4: // Copy the DOB from the record set to the view variable
5: if (pDX->m_bSaveAndValidate == FALSE)
6: m_oledtDOB = m_pSet->m_Birthdate;
7: //{{AFX_DATA_MAP(CTestdb5View)
8: DDX_FieldText(pDX, IDC_EID, m_pSet->m_AddressID, m_pSet);
9: DDX_FieldText(pDX, IDC_EFNAME, m_pSet->m_FirstName, m_pSet);
10: DDX_FieldText(pDX, IDC_ELNAME, m_pSet->m_LastName, m_pSet);
11: DDX_FieldText(pDX, IDC_ESNAME, m_pSet->m_SpouseName, m_pSet);
12: DDX_FieldText(pDX, IDC_ESTATE, m_pSet->m_StateOrProvince, m_pSet);
13: DDX_FieldText(pDX, IDC_ECITY, m_pSet->m_City, m_pSet);
14: DDX_FieldText(pDX, IDC_EADDR, m_pSet->m_Address, m_pSet);
15: DDX_FieldCheck(pDX, IDC_CBCARD, m_pSet->m_SendCard, m_pSet);
16: DDX_FieldText(pDX, IDC_ECOUNTRY, m_pSet->m_Country, m_pSet);
17: DDX_FieldText(pDX, IDC_EEMAIL, m_pSet->m_EmailAddress, m_pSet);
18: DDX_FieldText(pDX, IDC_EFAX, m_pSet->m_FaxNumber, m_pSet);
19: DDX_FieldText(pDX, IDC_EHPHONE, m_pSet->m_HomePhone, m_pSet);
20: DDX_FieldText(pDX, IDC_ENOTES, m_pSet->m_Notes, m_pSet);
21: DDX_FieldText(pDX, IDC_EWEXT, m_pSet->m_WorkExtension, m_pSet);
22: DDX_FieldText(pDX, IDC_EWPHONE, m_pSet->m_WorkPhone, m_pSet);
23: DDX_FieldText(pDX, IDC_EZIP, m_pSet->m_PostalCode, m_pSet);
24: DDX_Text(pDX, IDC_EDOB, m_oledtDOB);
25: //}}AFX_DATA_MAP
26: // Copy the DOB variable back from the view variable to the record set
27: if (pDX->m_bSaveAndValidate == TRUE)
28: m_pSet->m_Birthdate = m_oledtDOB;
29: }

So I added the line 5 and 6 + 27 and 28 like the book says, and compile, The code compiles and run and work like it should, But here the trouble starts, When returning to the ClassWizard I get a Parsing error: Expected “DDX_” Input line: if(pDX->m_bSaveAndValidate == FALSE) And then there is no Object ID’s no Members Function No nothing, the MFC ClassWizard is empty. I’m I doing something wrong or what??? Anyone got a similar problem and got a solution for it…

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!