procedure Tmodisf_form.Btn_okClick(Sender: TObject);
var  sqlstr,sqlstr1,mph,bh,sfrq:string;
    sf1,df1,qf1,wgf1,qtf1:real;
begin
  mph:=Trim(mph_edit.Text);
  if length(mph)<0 then
  begin
    ShowMessage('门牌号吾能为空,请输入!');
    mph_edit.SetFocus;
    exit;
  end;
  bh:=Trim(bh_edit.Text);
  sf1:=strTofloat(Trim(sf_edit.Text));
  df1:=strTofloat(Trim(df_edit.Text));
  qf1:=strTofloat(Trim(qf_edit.Text));
  wgf1:=strTofloat(Trim(wgf_edit.Text));
  qtf1:=strTofloat(Trim(qtf_edit.Text));
  sfrq:=Trim(dateTimeToStr(rq_dtp.DateTime));
 with adoquery1 do
  begin  
   sql.Clear;
    
    sql.Add('update sfb sef sf=:sf1,df=:df1,qf=:qf1 where (bh=:bh)') ;
    Parameters.ParamByName('bh').Value:=bh;
       
    Parameters.ParamByName('sf1').Value:=sf1;
    Parameters.ParamByName('df1').Value:=df1;
    Parameters.ParamByName('qf1').Value:=qf1;
    Parameters.ParamByName('wgf1').Value:=wgf1;
    Parameters.ParamByName('qtf1').Value:=qtf1;
    ExecSQL;
  end;
end;
end.
每次运行时总是出现这个错(''is  not a  valid  floating  point value),各位楼主,请指教!

解决方案 »

  1.   

    if length(mph)<0 then     /////////////////// 改为 if length(mph)<=0 then    试试
      begin
        ShowMessage('门牌号吾能为空,请输入!');
        mph_edit.SetFocus;
        exit;
      end;
      

  2.   

    sql.Add('update sfb sef sf=:sf1,df=:df1,qf=:qf1 where (bh=:bh)') ;//sef改为set, 不知是你抄错或写错?
    //或者你在 *.Text中输入一个INT值。
      

  3.   

    1:if length(mph)<0 then
    改成if length(mph)=0 then length永远没有小于0的时候2:ShowMessage('门牌号吾能为空,请输入!');
    改成ShowMessage('门牌号不能为空,请输入!');吾能是猪八戒3:各位楼主,请指教!只有你一个是楼主,不要乱套网络用语