C# parse string “0” to integer

前端 未结 8 955
抹茶落季
抹茶落季 2021-01-18 02:58

I have a new laptop at work and code that worked earlier in the week does not work today.

The code that worked before is, simplified:

while (dr.Read         


        
8条回答
  •  鱼传尺愫
    2021-01-18 03:34

    are you checking for null ?

    if(!dr.IsNull("FieldName")){
       int i = Convert.ToInt32(dr["FieldName"]))
    }
    

提交回复
热议问题