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

前端 未结 3 1469
小蘑菇
小蘑菇 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:56

    first convert that to a string, then get first character...

    char comboLabel = formCombo.Rows[j]["Combo_Label"].ToString()[0];
    

提交回复
热议问题