I\'m selecting from a SQL Server 2000 box CHAR(1)
column called Combo_Label
- it will always have a single A
..Z
character in
The database and the Db access APIs have no concept of char
. Your CHAR(1)
is mapped to string
.
probably the most sensible option:
string comboLabel = (string)formCombo.Rows[j]["Combo_Label"];
but if you really want a char
:
char comboLabel = ((string)formCombo.Rows[j]["Combo_Label"])[0];
The field is a string , you can do something like that but also need to consider if hte field is null or an emmpty string
char comboLabel = ((string)formCombo.Rows[j]["Combo_Label"])[0];
first convert that to a string, then get first character...
char comboLabel = formCombo.Rows[j]["Combo_Label"].ToString()[0];