datagridboolcolumn and sql server

  • Thread starter Thread starter Erald Kulk
  • Start date Start date
E

Erald Kulk

I have a problem with a datagridboolcolumn that drives me almost
crazy.

I have a sql server table with several columns of which one is a
column called ok which is a bit with default value 0. In a datagrid
that shows several columns of the table (with datagridtextboxcolumns)
I also included a datagridboolcolumn with true-value 'true' and
false-value 'false' and allownull=false. I had the sqldataadapter made
the dataset that is used for this datagrid. The DataSet has (when I
look into the xml-schema) a type for this ok-column boolean.
But it doesn't work. When running the application I can change the
column (which permanently shows the grey-null-state), but it
immediately changes back to its grey-null-state. When saving to the
database the value in the database is changed, but it never reappears
in my dataset.

What am I doing wrong. I searched a lot of sites, but didn't find the
answer yet.

Erald Kulk
 
Hi,

Two suggestions:

1. Design a typed dataset up front and populate it with the data adapter;
2. Inherit from the DataGridBoolColumn and override GetColumnValueAtRow and
SetColumnValueAtRow methods. Examine what is returned by the inherited
implementation, and you might get a better understanding of what is going
wrong.
 
Back
Top