Masonlu  

数据库中没有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);
                    }

 

posted on 2018-10-16 15:04  Masonlu  阅读(1846)  评论(0编辑  收藏  举报