473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Cannot addnew with Checkbox bound to bit column.

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.
--
Jeff
Jul 21 '05 #1
3 1345
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...B;EN-US;326440

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

Jul 21 '05 #2
That KB article addressed the problem.

"Kevin Yu [MSFT]" wrote:
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...B;EN-US;326440

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

Jul 21 '05 #3
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."

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: dixie | last post by:
I have some code that adds new records into a table for each ID in a list box when a button on a form is clicked. This works fine. My problem now is that I wish to be able to edit all the records...
2
by: Sebi | last post by:
Hello all is it possible to add a checkbox in a DataGrid for Boolean Data? Thanks in advance
1
by: Bigtoga | last post by:
Okay - I'm going crazy here trying to figure out how to do this - here goes: I have a DataList populated by a DataReader. In the DataReader, a column is present called "IsInCategory". I want to...
10
by: Jennyfer J Barco | last post by:
Hello, I have a datagrid that brings some information from a query. I need to have a checkbox in each row so the user can select the rows he wants to reprint. Is it possible to have a checkbox...
1
by: sianan | last post by:
I tried to use the following example, to add a checkbox column to a DataGrid in an ASP.NET application: http://www.codeproject.com/aspnet/datagridcheckbox.asp For some reason, I simply CAN'T get...
3
by: Jeff Grundy | last post by:
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...
4
by: Hexman | last post by:
Hello All, I'd like to find out the best way to add a cb column to a dgv and process efficiently. I see at least two ways of doing it. ------------------------------- 1) Add a cb to the dgv,...
9
by: mike7510uk | last post by:
Hi, I am using a gridview with a templatefield containing a checkbox. I want to update the database with a 1 or 0 depending on if a checkbox is checked or unchecked (then use the 1 or 0 later on...
3
by: =?Utf-8?B?Um9iZXJ0IFNtaXRo?= | last post by:
Hi, I have a GridView with a checkbox column in it called FromInsight, however this is not bound to the dataset, its value is based on another column from the dataset called sourceid For each...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.