Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / October 2004

Tip: Looking for answers? Try searching our database.

Cannot addnew with Checkbox bound to bit column.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff Grundy - 25 Oct 2004 20:33 GMT
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.
Signature

Jeff

Kevin Yu [MSFT] - 26 Oct 2004 04:22 GMT
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
Signature

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

Jeff Grundy - 26 Oct 2004 15:47 GMT
That KB article addressed the problem.

> Hi Jeff,
>
[quoted text clipped - 17 lines]
> "This posting is provided "AS IS" with no warranties, and confers no
> rights."
Kevin Yu [MSFT] - 27 Oct 2004 06:09 GMT
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
Signature

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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.