数据库中没有double型,float就表示double值。
sql server数据库字段类型与.net的数据类型的对应关系:

real(数据库)<--> float(.NET)
float(数据库)<--> double(.NET)

读取数据库中的float类型的字段要使用GetDouble方法
读取数据库中的real类型的字段时才应该使用GetFloat方法

 

                    while (read.Read())
                    {                       
                        b.SN = read.GetString(0);
                        b.ModuleClass = read.GetString(1);
                        b.IMGradeRule = read.GetString(2);
                        b.LEVEL_COLOR = read.GetString(3);
                        b.Pmax = read.GetDouble(4);
                        b.StandP = read.GetString(5).TrimEnd('W');
                        b.Im = read.GetDouble(6);
                        b.CtlValue = read.GetString(7);
                        b.MinValue = read.GetString(8);
                        b.MaxValue = read.GetString(9);
                        b.SchemeName = read.GetString(10);
                        b.PmaxId = read.GetString(11);
                    }

[C#]GetFloat提示"指定的转换无效"

 

相关文章:

  • 2022-01-18
  • 2022-12-23
  • 2021-08-08
  • 2022-12-23
  • 2021-06-05
  • 2021-06-01
  • 2021-12-28
  • 2021-07-03
猜你喜欢
  • 2022-12-23
  • 2021-09-17
  • 2021-06-05
  • 2021-11-05
  • 2021-06-13
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案