adoquery1.SQL.Text:='select sum(bianhao) from cangku where bianhao='''+ComboBox1.Text+'''';
这一句查询得出的总和值怎么读出来?

解决方案 »

  1.   

    mystring := adoquery1.FieldByName('sum(bianhao)').AsInteger;
      

  2.   

    var
      aint:integer;
    begin
      with adoquery1 do
      begin 
        sql.clear;  
        SQL.Text:='select sum(bianhao) from cangku where bianhao='''+ComboBox1.Text+'''';
        if not active then open;
        aint:=Fields[0].asinteger;
    end;
      

  3.   

    上面aint就是你要的值。快试试吧
      

  4.   

    select sum(bianhao) as sum_bianhao from...........:=fieldbyname('sum_bianhao').asinteger;
      

  5.   

    begin
    adoquery1.Close ;
    adoquery1.SQL.Clear ;
    adoquery1.SQL.Add('select sum(bianhao) from cangku where bianhao='''+ComboBox1.Text+''''');
    adoquery1.Active :=true;edit1.Text :=inttostr(adoquery1.Fields[0].asinteger);