inserting checkbox values to the database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bhargavigupta
    New Member
    • Aug 2007
    • 15

    inserting checkbox values to the database

    hi,
    In my application i have one checkbox when ever i am entering values to the page it has to store the values into the database table using insert statement , remaining values r inserting except checkbox value, i dont know in sql server 2005 which data type i have to use for that column to insert the checkbox checked values please reply me its very urgent
  • Kermit
    New Member
    • Aug 2007
    • 16

    #2
    if using OleDB OleDbType.Boole an should work :)
    for SQL try SqlDbType.Bit

    Comment

    • bhargavigupta
      New Member
      • Aug 2007
      • 15

      #3
      Originally posted by Kermit
      if using OleDB OleDbType.Boole an should work :)
      for SQL try SqlDbType.Bit





      hi thank u
      it is inserting the values but it is storing 1 in that column instead of true how can change it to true

      Comment

      • Shashi Sadasivan
        Recognized Expert Top Contributor
        • Aug 2007
        • 1435

        #4
        Could you please make sure that the field which is supposed to be boolean is actually a bit, rather than an int or something?

        Comment

        • bhargavigupta
          New Member
          • Aug 2007
          • 15

          #5
          Originally posted by Shashi Sadasivan
          Could you please make sure that the field which is supposed to be boolean is actually a bit, rather than an int or something?

          hi
          in this i want boolean type only what i said is it is storing the values as 0's and 1's instead of that shall i change i in to the form of true and false

          Comment

          • Kermit
            New Member
            • Aug 2007
            • 16

            #6
            The SqlDBType.Bit may store 0, 1, or Null values to the database (see tooltip). Basicly it is the same, but maybe sql stores true/false as 0's or 1's?

            Comment

            • bhargavigupta
              New Member
              • Aug 2007
              • 15

              #7
              Originally posted by Kermit
              The SqlDBType.Bit may store 0, 1, or Null values to the database (see tooltip). Basicly it is the same, but maybe sql stores true/false as 0's or 1's?

              thank u
              i am getting like that only yes it is storing in the form of 0's and 1's
              and i have one more doubt regarding Contact number ,it is U.S Phone number it is having ' - ' symbols in between numbers so for this which datatype i can use
              i used integer but it is treating like minus symbol......... .......

              Comment

              • Kermit
                New Member
                • Aug 2007
                • 16

                #8
                use varchar with an input mask (something like ie. 000\-000\-000;0;)

                Comment

                Working...