Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Bool data type issue

Bool data type issue

Scheduled Pinned Locked Moved C / C++ / MFC
help
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    Hi, I am getting boolean value from store procedure.When flag is set, it fill value 255 otherwise 0. It should be 1/0. When i tried to declared varaible type bool no data is coming and it is showing garbage.Can you please help me. Thank :sigh:

    D J 2 Replies Last reply
    0
    • A Anonymous

      Hi, I am getting boolean value from store procedure.When flag is set, it fill value 255 otherwise 0. It should be 1/0. When i tried to declared varaible type bool no data is coming and it is showing garbage.Can you please help me. Thank :sigh:

      D Offline
      D Offline
      Dezhi Zhao
      wrote on last edited by
      #2

      simple: suppose c is what you get from the stored proc and b is the boolean you want. just do this: b = c & 1; cast (c & 1) to bool if needed

      1 Reply Last reply
      0
      • A Anonymous

        Hi, I am getting boolean value from store procedure.When flag is set, it fill value 255 otherwise 0. It should be 1/0. When i tried to declared varaible type bool no data is coming and it is showing garbage.Can you please help me. Thank :sigh:

        J Offline
        J Offline
        John M Drescher
        wrote on last edited by
        #3

        I believe this is the correct result as VARIANT_TRUE is defined as -1, VARIANT_FALSE is 0. What database are you using? John

        I 1 Reply Last reply
        0
        • J John M Drescher

          I believe this is the correct result as VARIANT_TRUE is defined as -1, VARIANT_FALSE is 0. What database are you using? John

          I Offline
          I Offline
          itkid
          wrote on last edited by
          #4

          Thank you for your reply. I think you are right, for interger it is showing -1 for set flag. I am using SQL server. ~Pankaj

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups