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

Thread: GetFieldValue return the wrong value

  1. #1
    Join Date
    Aug 2001
    Posts
    60

    GetFieldValue return the wrong value

    Dear guru.

    the code below.

    COleVariant varValue;

    m_pRecordSet->GetFieldValue("string field",varValue);
    AfxMessageBox(V_BSTRT(&varValue)); //-->return right value

    //but the line below return wrong value. for example my value is 5 but it return 1539825157
    m_pRecordSet->GetFieldValue("int field",varValue);
    int i = varValue.intVal;

    char buffer[20];
    itoa(i,buffer,10);
    AfxMessageBox(buffer); //-->return wrong value

    if anyone know how to solve this problem pleas help me.

    Thank You.

  2. #2
    Join Date
    Aug 2001
    Posts
    60
    Sorry for bad English.

  3. #3
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,116
    Look carefully wat what varValue contains in the VT member. I think you will find it contains a string representation of your fields contents
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)