CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2005
    Posts
    1,030

    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
    Location
    Florida
    Posts
    12,635

    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
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    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
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

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