Check box isssue when bound to a database column
I am using a check box control which is bound to a Oracle Table Column of
type SMALLINT. The columan can accept only 1 or 0 to be in sync. with the
Check Box state. I have a single record in the corresponding table. The value
of the column bound to the check box is 1. I am using a ADO Data Control
along with a ADO Data Grid to display the tabular view of the data in the
corresponding table. Since there is only one record in the table the Grid
displays the record and also the check box indicates the correct status of
the values of the column bound to it (which has 1 as the value).
So the check box is checked. Now when provide and interface to allow add
new records to the table through a command button I add the foll. line of
code in the click event of command button :-
When the above code is executed it inserts a blank record in the grid and
in the recordset also, but the check box control is still in the checked
state and also greyed (Checkbox1.Value = 2) (but not disabled). Now when
I go and click on the check box to remove the check mark the Value property
changes to -1 instead of 0 and when I again click on the check box it changes
to 0 instead of 1 and it never makes the Value property to be 1 at all. This
happens only if it is bound to a column in the database table. If it is a
normal control it doesn't behave like this.
The greyed state of check box happens only when AddNew is called. Otherwise
the check box indicates the right values as it is entered in the corresponding
column. Can anyone help solving this issue.