I need some help with DBNull and checkboxes
-
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
-
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
To Check if a field's value is null: dataset.tables[0].row[0]["Field_Name"] == DBNull.Value Was it a cat I saw?
-
To Check if a field's value is null: dataset.tables[0].row[0]["Field_Name"] == DBNull.Value Was it a cat I saw?
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