如何将sql查询到的结果保存在一个变量中?

解决方案 »

  1.   

    用循环啊!!!
    with quReport do
      begin
        First;
        for Row := 1 to RecordCount  do
        begin
          for i:=1 to exportcount do
          begin
            if (isdigit[i]=false ) then
              XLSWrite.WriteString(i-1 ,Row+1, -1, FieldByName(exportcolumn[i]).AsString)
            else
              XLSWrite.WriteNumber(i-1 ,Row+1, -1, FieldByName(exportcolumn[i]).AsInteger);
          end;
          Next;
        end;
      end;
      XLSWrite.CloseFile;
      

  2.   

    我查询的结果是一个记录,将此记录的一项结果显示在edit中。
      

  3.   

    单个字段:edit1.text:=adoquery.filedByName('字段名').asstring;
    多个字段:edit1.text:=adoquery.filedByName('字段名').asstring
    +adoquery.filedByName('字段名2').asstring+……;