RFX_Double returns garbage value when parsing NULL from a table.
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: RFX_Double returns garbage value when parsing NULL from a table.

  1. #1
    Join Date
    Jul 2005
    Posts
    910

    RFX_Double returns garbage value when parsing NULL from a table.

    If I call RFX_Double(pFX, _T("Amount"), m_Amount) in MFC, the value under the column "Amount" is NULL, then m_Amount is set to garbage. How can I set m_Amount to 0 in this case? Thanks.

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,107

    Re: RFX_Double returns garbage value when parsing NULL from a table.

    Quote Originally Posted by LarryChen View Post
    If I call RFX_Double(pFX, _T("Amount"), m_Amount) in MFC, the value under the column "Amount" is NULL, then m_Amount is set to garbage. How can I set m_Amount to 0 in this case? Thanks.
    Look in MSDN under the CRecordset functions. You'll find what you're looking for, and you'd find it faster than asking here.

  3. #3
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,026

    Re: RFX_Double returns garbage value when parsing NULL from a table.

    In a database, NULL value means "unspecified/unknown/not set".
    Not 0 (zero) or another particular value, so it's nothing wrong if a RFX function gives you garbage.
    To solve your problem, the best solution is to re-design the table and add NOT NULL constraint and/or set default value 0 for that field.
    Ovidiu Cucu
    "When in Rome, do as Romans do."
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: http://codexpert.ro/blog/author/ovidiu-cucu/

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

This is a CodeGuru survey question.


Featured


HTML5 Development Center