CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  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

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