run_program表:
claspno_t xpoint_n ypoint_n spoint_n endpoint_n
  1         150       200      180     150
  2         120       300      200     200
  3 ……………………………………………………
…………………………………………………………
现在用SQL语句如下:begin
   adoquery1.close;
   adoquery1.SQL.clear;
   adoquery1.sql.add('select xpoint_n from run_program where claspno_t =1 ');
   adoquery1.open;
   
end;接下来该怎么办??如题

解决方案 »

  1.   

    有直接的方法吗,我也想知道,
    来个笨点的方法吧,就是你直接取出表中的数据赋值给数值-----------------
    行舟
    欢迎使用CSDN论坛浏览器
    http://blog.csdn.net/xingzhou/
      

  2.   

    先定义一个全局变量
    VAR
      S:ARRAY OF INTEGER //这里你自己看你的数据类型来定数组类型
    ==================================
    VAR
     I:INTEGER;
    begin
       adoquery1.close;
       adoquery1.SQL.clear;
       adoquery1.sql.add('select COUNT(xpoint_n)AS NUM,xpoint_n from run_program where claspno_t =1 ');
       adoquery1.open;
       SETLENGTH(S,NUM);
       while not eof do
       begin
         S[I]:=FieldByName('xpoint_n').asinteger;
         inc(i);
         next;
       end;
    END;
      

  3.   

    用个循环一条条赋值吧。
    first;
    while not eof do
    begin
      赋值;
      next;
    end;
      

  4.   

    如果记录不都是数值型,可以用变量数组。
    var
      i: integer;
      CurrField: array of variant;
    begin
      with ADOQuery1 do
      begin
        Close;
        SQL.Text := '';
        Open;
        SetLength(CurrField, ADOQuery1.FieldCount);
        for i := 0 to ADOQuery1.FieldCount - 1 do
        begin
          CurrField[i] := FieldByName('').Value;
        end;
      end;
    end;