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. .NET (Core and Framework)
  4. how to convert the property into bit from bool?

how to convert the property into bit from bool?

Scheduled Pinned Locked Moved .NET (Core and Framework)
questiondatabasehelptutorial
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.
  • T Offline
    T Offline
    TARAK NATH ROY
    wrote on last edited by
    #1

    I have a property that return bool value. And the corresponding data type of field in table of this property is bit type. When I want to save this bool type property it gives the error due to the data which i am going to save in database that's data type is bit type. My question is how to convert the property into bit from bool? with regards tarak

    T L T 3 Replies Last reply
    0
    • T TARAK NATH ROY

      I have a property that return bool value. And the corresponding data type of field in table of this property is bit type. When I want to save this bool type property it gives the error due to the data which i am going to save in database that's data type is bit type. My question is how to convert the property into bit from bool? with regards tarak

      T Offline
      T Offline
      T2102
      wrote on last edited by
      #2

      You can use the system convert functions. I would assume 0 <-> false and 1 <-> true

      1 Reply Last reply
      0
      • T TARAK NATH ROY

        I have a property that return bool value. And the corresponding data type of field in table of this property is bit type. When I want to save this bool type property it gives the error due to the data which i am going to save in database that's data type is bit type. My question is how to convert the property into bit from bool? with regards tarak

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        While passing values to a bit parameter of an SQL Stored Procedure, use 0 for false and 1 for True.

        1 Reply Last reply
        0
        • T TARAK NATH ROY

          I have a property that return bool value. And the corresponding data type of field in table of this property is bit type. When I want to save this bool type property it gives the error due to the data which i am going to save in database that's data type is bit type. My question is how to convert the property into bit from bool? with regards tarak

          T Offline
          T Offline
          The Man from U N C L E
          wrote on last edited by
          #4

          If you have correctly defined your parameter objects they will translate bool to bit and bit to bool automaticaly. What is the .net code you have used to make the database call?

          If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

          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