SQLSEVER2000数据库表中存放的某一字段的数据是0.000031,现在用delphi将这一结果查询出来,确显示为0,只取了前四位小数点,到底应该怎么做啊?急死人了
ADOQuery1.SQL.Text:='select p as 概率0, z1 as 字段1 ,z2 as 字段2 from 二元频次统计表 where 序号='+inttostr(num)+' ';//查询语句
ADOQuery1.Open;
p0:=ADOQuery1.FieldByName('概率0').Asfloat;
showmessage (floattostr(P0));
数据库中P字段的类型是Decimal9(18,6),p0的类型是double,是不是这里有问题啊?
ADOQuery1.SQL.Text:='select p as 概率0, z1 as 字段1 ,z2 as 字段2 from 二元频次统计表 where 序号='+inttostr(num)+' ';//查询语句
ADOQuery1.Open;
p0:=ADOQuery1.FieldByName('概率0').Asfloat;
showmessage (floattostr(P0));
数据库中P字段的类型是Decimal9(18,6),p0的类型是double,是不是这里有问题啊?
ADOQuery1.SQL.Text:='select Format('%.6f', p) as 概率0, z1 as 字段1 ,z2 as 字段2 from 二元频次统计表 where 序号='+inttostr(num)+' ';//查询语句
ADOQuery1.Open;
p0:=ADOQuery1.FieldByName('概率0').Asfloat;
showmessage (floattostr(P0));
试试!
希望你早日解决
正常那么就是数据类型不匹配的问题,一己之见