數據庫中沒有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); }