CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2003
    Location
    Singapore
    Posts
    9

    Unhappy Window Application Error Message

    Hi all,

    I'm trying to pick up VC++ and have been trying to write a Win App that could access a MS Access database using the CDao class.

    I've managed to compile w/o any error or warning, however when I tried to run the prog it crashes and generated a couple of error messgae which I've captured and attached.

    Below is also a sniplet of code which I think triggers the error:-

    I've tried all the tricks I know, and just can't get it to work!! If someone could help I would be most grateful...

    Best Regard,
    Tony

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    void CNewRecordDlg::OnSave()
    {
    // TODO: Add your control notification handler code here

    char buf[256];

    COleVariant vEmployeeID = m_rsRecords.GetFieldValue("EmployeeID");
    COleVariant vName = m_rsRecords.GetFieldValue("Name");
    COleVariant vAddress = m_rsRecords.GetFieldValue("Address");
    COleVariant vAge = m_rsRecords.GetFieldValue("Age");
    COleVariant vSex = m_rsRecords.GetFieldValue("Sex");
    COleVariant vSalary = m_rsRecords.GetFieldValue("Salary");
    COleVariant vContactNumber = m_rsRecords.GetFieldValue("ContactNumber");

    vName.SetString(m_strName,VT_BSTRT);
    m_rsRecords.SetFieldValue("Name",vName);

    vAddress.SetString(m_strAddress,VT_BSTRT);
    m_rsRecords.SetFieldValue("Address",vAddress);

    sprintf(buf,"m_intAge");
    vAge.SetString(buf,VT_BSTRT);
    m_rsRecords.SetFieldValue("Age",vAge);

    //vSex.SetString(m_strSex,VT_BSTRT);
    //setting sex to "M" till I figured this radio button thing out...
    m_rsRecords.SetFieldValue("Sex","M");

    sprintf(buf,"m_floatSalary");
    vSalary.SetString(buf,VT_BSTRT);
    m_rsRecords.SetFieldValue("Salary",vSalary);

    sprintf(buf,"m_intContactNo");
    vContactNumber.SetString(buf,VT_BSTRT);
    m_rsRecords.SetFieldValue("ContactNumber",vContactNumber);

    m_rsRecords.Update();

    CDialog::OnInitDialog();

    CDialog::OnOK();

    }
    Attached Files Attached Files

  2. #2
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917
    You have done fine work documenting your problem but this only touches a surface.

    Usually this kind of error manifests itself when un-initialized pointer is used, pointing into some random memory area.

    I hope you are running in debug mode. You can always check stack window and back up to find what could cause problem.

    Try to post some debug trace messages as well as points of assertions if any (line and file name).

    What environment are you using and what version?
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

  3. #3
    Join Date
    Mar 2003
    Location
    Singapore
    Posts
    9

    Unhappy

    Thanks for advise. I'm using NT4 & yes, in debug mode... BTW using VC++ 6

    I've tried that stack window and I guess the problem lies in the following statement...

    vName.SetString(m_strName,VT_BSTRT);
    m_rsRecords.SetFieldValue("Name",vName);

    The problem is I haven't the slightess clue why this doesn't work, cos I did exactly as the VC++ MFC example suggested. (see "A Beginner's Guide to using Databases from MFC with DAO" by Nigel Thompson.)

    Anyway, I've a bunch of error from the output window during the debug, if its any help in shedding some light to this problem...

    coming back to the problematic statements, it seems that SetString has failed me by not capturing the information, but I don't know why.....

    output window~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Loaded 'C:\WINNT\System32\ntdll.dll', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\MFC42D.DLL', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\MSVCRTD.DLL', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\KERNEL32.DLL', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\GDI32.DLL', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\USER32.DLL', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\ADVAPI32.DLL', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\RPCRT4.DLL', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\MFCO42D.DLL', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\MFCD42D.DLL', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\indicdll.dll', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\imm32.dll', no matching symbolic information found.
    Loaded 'C:\Program Files\Hotbar\bin\4.2.8.0\HbHostOE.dll', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\COMCTL32.DLL', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\msidle.dll', no matching symbolic information found.
    Warning: no message line prompt for ID 0x8003.
    Loaded 'C:\WINNT\system32\OLEAUT32.DLL', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\OLE32.DLL', no matching symbolic information found.
    Loaded 'C:\Program Files\Common Files\Microsoft Shared\DAO\DAO350.DLL', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\msvcrt40.dll', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\MSVCRT.DLL', no matching symbolic information found.
    Loaded symbols for 'C:\WINNT\system32\MSVCIRT.DLL'
    Loaded 'C:\WINNT\system32\MSJET35.DLL', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\VBAJET32.DLL', no matching symbolic information found.
    Loaded 'C:\WINNT\system32\EXPSRV.DLL', no matching symbolic information found.
    First-chance exception in Test.exe (MFCO42D.DLL): 0xC0000005: Access Violation.
    The program 'D:\Program Files\Microsoft Visual Studio\MyProjects\Test.2.1\Debug\Test.exe' has exited with code 0 (0x0).

  4. #4
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917
    Originally posted by Tony Choo
    see "A Beginner's Guide to using Databases from MFC with DAO" by Nigel Thompson
    Tony I do not have a book therefore I do not know what Nigel Thompson wrote.

    Output window does not show any error messages, it shows that dlls that are loaded do not have corresponding symbol files.

    It is near impossible for me to pinpoint a problem without debugging real code. Check validity of your variables in places you suspect something wrong is going on.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured