Error casting CHAR(1) SQL column as “char” in code

前端 未结 3 1479
小蘑菇
小蘑菇 2021-01-26 16:31

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

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-26 16:44

    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];

提交回复
热议问题