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#
  4. I need some help with DBNull and checkboxes

I need some help with DBNull and checkboxes

Scheduled Pinned Locked Moved C#
databasecomhelpquestion
3 Posts 2 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
    Tom Wright
    wrote on last edited by
    #1

    I created a tabbed app that has a number of checkboxes on the second tab. I'm using currency manager to keep track of the number of records that are currently in the DB as well as adding, deleting records. I also am using data view to sort my records based on what the end user is looking for. When I go to add a new record and click on the second tab, I get a DBNull exception. I've made sure that the fields in the database are set to not allow nulls, and with a default value of zero. I want to do a check to make sure that if the field is null then the binded field = false? Or is there a better way to do this? Thanks Tom Wright tawright915@yahoo.com -- modified at 15:13 Wednesday 12th April, 2006

    J 1 Reply Last reply
    0
    • T Tom Wright

      I created a tabbed app that has a number of checkboxes on the second tab. I'm using currency manager to keep track of the number of records that are currently in the DB as well as adding, deleting records. I also am using data view to sort my records based on what the end user is looking for. When I go to add a new record and click on the second tab, I get a DBNull exception. I've made sure that the fields in the database are set to not allow nulls, and with a default value of zero. I want to do a check to make sure that if the field is null then the binded field = false? Or is there a better way to do this? Thanks Tom Wright tawright915@yahoo.com -- modified at 15:13 Wednesday 12th April, 2006

      J Offline
      J Offline
      junglerover77
      wrote on last edited by
      #2

      To Check if a field's value is null: dataset.tables[0].row[0]["Field_Name"] == DBNull.Value Was it a cat I saw?

      T 1 Reply Last reply
      0
      • J junglerover77

        To Check if a field's value is null: dataset.tables[0].row[0]["Field_Name"] == DBNull.Value Was it a cat I saw?

        T Offline
        T Offline
        Tom Wright
        wrote on last edited by
        #3

        Thanks but I ended up fixing my problem this way. Right before I add a new record I set the default value of the columns ds.Tables[0].Columns["FieldName"].DefaultValue = false; This seems to have done the trick. Now I'm having problems saving mulitpule times on the same record. Thanks Tom Wright tawright915@yahoo.com

        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