How to get float value with SqlDataReader?

前端 未结 7 2266
执念已碎
执念已碎 2020-12-20 13:49

In my database, I have NextStatDistanceTime value as a float. When \"float time = reader.GetFloat(0);\" line excecuted, it gives an error of

相关标签:
7条回答
  • 2020-12-20 14:33

    you can try:

    float time = float.Parse(reader[0].ToString());
    

    also note (though not related with your Q) that you don't need to run

    command.ExecuteNonQuery();
    
    0 讨论(0)
提交回复
热议问题