Tinyint(1) maps to Int16
Tinyint(1) maps to Int16
Many of my tables have TinyInt(1) columns. MySQLDirect maps this type to the CTS Int16 type.
I use the VS2005 DataSet Designer and GridViews in my projects. When I have a TinyInt(1) column in a table I want that it to appear as a Checkbox in my GridViews. To do this I change the DataType from Int16 to TinyInt(1) for the column in the DataSet designer, and it then automatically appears as a Checkbox. This works fine. The problem is if I make any changes to the TableAdaptor, such as adding a column, then the designer automatically adds a new column, naming it [originalcolumnname]1 with type Int16. It also unbinds the old column. I have to play around with the columns until I get it back to the way I want it. This is very time consuming, and frustrating.
My questions are:
(1) Is it possible to have TinyInt(1) columns automatically mapped to the Boolean type?
(2) If not, is there a way around what I am doing?
I could keep the column as Int16, and make the adjustments at the GridView level. But, it effectively causes me the same problem and takes even more time. If I refresh the DataSource schema of the GridView then I will have to convert the column to a checkbox again.
Any help would be greatly appreciated. Many thanks.
I use the VS2005 DataSet Designer and GridViews in my projects. When I have a TinyInt(1) column in a table I want that it to appear as a Checkbox in my GridViews. To do this I change the DataType from Int16 to TinyInt(1) for the column in the DataSet designer, and it then automatically appears as a Checkbox. This works fine. The problem is if I make any changes to the TableAdaptor, such as adding a column, then the designer automatically adds a new column, naming it [originalcolumnname]1 with type Int16. It also unbinds the old column. I have to play around with the columns until I get it back to the way I want it. This is very time consuming, and frustrating.
My questions are:
(1) Is it possible to have TinyInt(1) columns automatically mapped to the Boolean type?
(2) If not, is there a way around what I am doing?
I could keep the column as Int16, and make the adjustments at the GridView level. But, it effectively causes me the same problem and takes even more time. If I refresh the DataSource schema of the GridView then I will have to convert the column to a checkbox again.
Any help would be greatly appreciated. Many thanks.
-
- Posts: 37
- Joined: Fri 11 Feb 2005 19:18
From MySQL AB:
So tinyint(1) stores values -128 .. 127, and it cannot be mapped to the bool.Another extension is supported by MySQL for optionally specifying the display width of an integer value in parentheses following the base keyword for the type (for example, INT(4)). This optional display width specification is used to left-pad the display of values having a width less than the width specified for the column.
-
- Posts: 37
- Joined: Fri 11 Feb 2005 19:18
Having a similar prob. Was there a way to force the table or the DataView to map that particular column into a bool? If so what does that code look like?
Wasn't MySQL 5 supposed to support BOOLEANS? I go to the MySQL administrator it lets me alter columns to BOOLEANs but as soon as I exit and come back they are Tinyints again.....its really annoying.
Wasn't MySQL 5 supposed to support BOOLEANS? I go to the MySQL administrator it lets me alter columns to BOOLEANs but as soon as I exit and come back they are Tinyints again.....its really annoying.
-
- Posts: 729
- Joined: Thu 13 Dec 2007 10:24