Cannot addnew with Checkbox bound to bit column.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Why does addnew fail when I have a checkbox bound to a sql bit column?

steps to recreate the problem:

1 - Create a table in sql with a varchar and a bit column.
2 - Add a couple of records to the table so you can see that the dataform is
actually working
3 - Use the DataFormWizard to create a form bound to that table (On the
'Choose Display Style' page of the wizard select the 'Single Record in
individual controls' raido button)
4 - Set Project Startup Object to the new dataform.
5 - Run project.
6 - Press the 'Load' button on the new dataform.
7 - Press the add button.

I am unable to add new records. the X of x counter indicates a new record
has benn added but I am unable to get to it using the nav buttons.

If I set the databindings-checked property of the checkbox to (none) i am
able to add a new record.
 
Hi Jeff,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you have bounded a checkbox to bit
column, you cannot add a new record to the Dataset. If there is any
misunderstanding, please feel free to let me know.

As far as I know, this is a known issue. When the checkbox is bound to a
bit column and its default value is not set, the field value has to be
DBNull when a new row is added. However, the checked property knows nothing
about DBNull, so it fails. The workaround is to add a default value to the
bit column in either schema or code.

Here is a KB article for more information on this issue. HTH.

http://support.microsoft.com/default.aspx?scid=KB;EN-US;326440

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi Jeff,

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top